Re: Random sort via SQL in ASP



On Apr 12, 10:40 pm, eng...@xxxxxxxxxxxx wrote:
On Apr 12, 9:13 pm, eng...@xxxxxxxxxxxx wrote:



On Apr 12, 7:33 pm, "muskie" <goo...@xxxxxxxxxxxxxxxx> wrote:

I've looked through as many posts about this as possible, but all end
with no resolution. I simply need records from a table in random
order, and I will be calling this recordset in a SQL statement from
ASP. I've tried the following but it does not produce random order:

SELECT * FROM Table1 ORDER BY Rnd(TableID) ASC;

where TableID is an autonumber field.

I've seen references to Randomize, but how do you use Access's
randomize from ASP?

Does anyone know of a simple solution for this?

Thanks,
Matt

I'd be surprised if you can use this in SQL using the method you are
trying. I'd write some code that you can trigger that puts a random
number in a field (e.g. sortfield as long) in the table. Then you can
select and order by that random field (e.g. ORDER BY sortfield). This
will certainly get the job done. Whenever you want a different
randomizing, then trigger the code.

-- Larry Engles- Hide quoted text -

- Show quoted text -

If you have an autonumber feild, you could use that in the query (e.g.
ORDER BY (autonumberField).
-- Larry Engles

Thanks Larry, I appreciate the input...
If I run my query in Access it works to produce a randomly sorted
recordset. If I run the exact same query from my ASP it does not.
Any idea why this happens?

.



Relevant Pages

  • Re: Problem passing empty form fields to access parameter query
    ... Access2000 and how to pass parameters from forms in ASP. ... The query should return all records if the parameters are empty.This ... dim param_minvalue ... Your resultset will be returned in the recordset rs. ...
    (microsoft.public.inetserver.asp.db)
  • Re: Sending ASP variable to Database Results Wizard query
    ... I was hoping to build my query using ASP and then dropping it into the DRW ... to narrow my recordset as shown in the query of my first message. ...
    (microsoft.public.frontpage.client)
  • Re: run sp and return results to .asp
    ... Views do not support cursors. ... next recordset if you return more than one. ... > I've written a fairly complex query in sql2k, but when I attempt to paste ... I want to be able to call the sp from the .asp page, ...
    (microsoft.public.sqlserver.datamining)
  • Re: Random sort via SQL in ASP
    ... whereas when running from ASP ... number in a field (e.g. sortfield as long) in the table. ... select and order by that random field (e.g. ... If you have an autonumber feild, you could use that in the query (e.g. ...
    (comp.databases.ms-access)
  • application/vnd.ms-excel
    ... I am using the below snipped of code to dump the Recordset content in my asp ... page to an excel file. ... However when the query is complete the content gets displayed to the web ...
    (microsoft.public.inetserver.asp.general)