Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 how to generate a random order?

Author  Topic 

p2bl
Yak Posting Veteran

54 Posts

Posted - 2001-09-07 : 10:21:11
Now.here is a table which has one identity column "ID",and some other columns.The question is:how to generate a random order use "SELECT" clause?
I have tried with rand()

SELECT id,....,rand() as rnder from table1 order by rnder

but it doesn't work,cause rand() only excute once.so I make a little change

SELECT id,....,rand(id) as rnder from table1 order by rnder

this time,rand have a seed,but every time the SQL execute,it has the same order.

now,I have no idea.Can u help me??

   

- Advertisement -