I\'ve got a SQL Server table with about 50,000 rows in it. I want to select about 5,000 of those rows at random. I\'ve thought of a complicated way, creating a temp table wi
Just order the table by a random number and obtain the first 5,000 rows using TOP.
TOP
SELECT TOP 5000 * FROM [Table] ORDER BY newid();
UPDATE
Just tried it and a newid() call is sufficent - no need for all the casts and all the math.
newid()