SQL Server – Best Way to Get Random Ordering

sql server

I have a query where I want the resulting records to be ordered randomly. It uses a clustered index, so if I do not include an order by it will likely return records in the order of that index. How can I ensure a random row order?

I understand that it will likely not be "truly" random, pseudo-random is good enough for my needs.

Best Answer

ORDER BY NEWID() will sort the records randomly. An example here

SELECT *
FROM Northwind..Orders 
ORDER BY NEWID()