Few days back, I posted a query to return a random row by using RowNum function. A reader has pointed out a more simpler way to achieve the same result. Following is the new and quicker way to return the random row:
select top 1 ColumnList
from TableName
order by newid()
Just replace “ColumnList” and “TableName” with list of columns and name of table respectively.
I will really appreciate, if someone can give comments about the performance of both approaches.