Monday, January 20, 2014

Select Random Rows from SQL Server DB Table


Wanted to select random rows from a table for some analysis. Found this.

 SELECT * FROM TABLENAME
  WHERE (ABS(CAST(
  (BINARY_CHECKSUM
  (COLUMNNAME, NEWID())) as int))
  % 100) < 1