Quantcast
Viewing all articles
Browse latest Browse all 9

randomize in T-SQL

Hello,

If you're looking to choose random rows from a set, use NEWID() instead as such:

select top 5 * from sys.columns order by NEWID()

Just be careful about using it over very large data sets as you're adding a 16 byte GUID to the end of the results.

-Sean


Sean Gallardy | Blog | Twitter


Viewing all articles
Browse latest Browse all 9

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>