How to return rows in random order in SQL Server ?


This content was proof-read by Grammarly. You can Try Grammary for FREE

Do you want to return rows sorted in random order , here’s how you do it.

How to return rows in random order in SQL Server ?

This example demonstrates how to sort the Employee table and display the results in random order.

Use AdventureWorks2014
GO
SELECT 
    * 
FROM 
    HumanResources.Employee
ORDER BY 
    CHECKSUM(NEWID())
How to return rows in random order in SQL Server ?
%d bloggers like this: