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)
 Select 10 Random Records

Author  Topic 

shapper
Constraint Violating Yak Guru

450 Posts

Posted - 2008-04-22 : 21:24:12
Hello,

Is it possible to select 10 random records from a table?

Thanks,
Miguel

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-04-22 : 22:08:24
Yes. It should have been pretty easy to find the solution if you had searched for it.

SELECT TOP 10 *
FROM YourTable
ORDER BY NEWID()

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -