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 2005 Forums
 Transact-SQL (2005)
 Retrive rows

Author  Topic 

sqlfresher2k7
Aged Yak Warrior

623 Posts

Posted - 2010-10-07 : 11:19:01
How to retrieve the rows of randoms numbers.
Ex:there are 10 rows of the randoms number

RandomNo
-------
4
3
6
7
9
1
2
5
0
8

I need a query to retrive 5 rows random.
like sampling techniques.




jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2010-10-07 : 11:56:02
select top 5 *
from yourTable
order by newid()-- this is the random part

Jim

Everyday I learn something that somebody else already knew
Go to Top of Page
   

- Advertisement -