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)
 Random Rows

Author  Topic 

oahu9872
Posting Yak Master

112 Posts

Posted - 2006-01-18 : 14:12:53
I would like to write a function that randomly selects rows from a table. Does anyone know how to do that?

Thanks

SamC
White Water Yakist

3467 Posts

Posted - 2006-01-18 : 14:21:40
[CODE]SELECT TOP 1 *
FROM MYTABLE
ORDER BY NEWID()[/CODE]
Go to Top of Page

oahu9872
Posting Yak Master

112 Posts

Posted - 2006-01-18 : 15:05:15
I'll give it a try, thanks.
Go to Top of Page
   

- Advertisement -