Monday, March 5, 2012

Get a random row on SQL Server

Pretty simple method for getting a random row on SQL Server.
SELECT TOP 1 column FROM table ORDER BY NEWID()

More ways to get random rows on other databases can be seen here.
As well as another article on random rows on SQL Server.

No comments:

Post a Comment