Wednesday, March 7, 2012

how to retrieve random values from a database table

how to retrieve randomly rows from a sqlserver database tableHi,

Use TABLESAMPLE

Example.

SELECT FirstName, LastName
FROM Person.Contact
TABLESAMPLE (10 PERCENT) ;

OR

SELECT FirstName, LastName
FROM Person.Contact
TABLESAMPLE (10 ROWS) ;

No comments:

Post a Comment