Select Random Rows from Table in SQL Server

To Select 1 Random Records from a table in SQL Server

 

SELECT TOP 1 * FROM Table_Name
ORDER BY NEWID() ;

 

To Select 10 Random Records from a table in SQL Server

 

SELECT TOP 10 * FROM tAudit
ORDER BY NEWID()

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s