Randomly sorting query results in SQL Server using NewId()

To randomly sort query results using NewID() UniqueIdentifier use this code:

FROM Table_name ORDER BY NewId()

It will randomly sort the records in the table.

To randomly sort the records in the Person.Person table:

FROM Person.Person ORDER BY NewId()


If the post helped you, please share it:
Pin It

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">