SQL Tip: Select a random row from a SQL database table

So how do you select a random row in a SQL database table?

[codesyntax lang=”sql”]

SELECT TOP 1 Name, Address, City
FROM         tbl_Person
ORDER BY NEWID()

[/codesyntax]

This will select a random person every time.

Click Here to Leave a Comment Below 0 comments

Leave a Reply: