Wednesday, July 6, 2011

Select random rows with Microsoft SQL Server?

Select random rows in SQL Server

SELECT Top 10* FROM [Table Name] ORDER BY NEWID()

You can select top 10 random rows by the above query each time you can get different 10 rows. This query randomly select data each time when you execute query.




1 comment:

  1. to get the random rows in sql is new to me. it amazed me.

    ReplyDelete

Note: Only a member of this blog may post a comment.