Sunday, March 11, 2012

Select random records in SQL

 

If you want random record when you run your query then you can use the below code. It takes new record each time when your run the query.

SELECT TOP 1 * FROM TableName ORDERBY newid()

1 comment:

  1. Thanks for sharing your info. I really appreciate your efforts and I will be waiting for your further write updates thanks once again software training institutes | Summer training in embedded

    ReplyDelete

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