.

Retrieving a sample of table data

To only select a random portion of a table:

select * from patients
tablesample (.1 percent);
--or tablesample (50 rows);
--and even append: repeatable(15); 

There will be times (when you work with statistics) that this won’t give accurate results. Try the following then instead (due to the combination of paging and clustered indexes):

select avg(total) from price
where 0.001 >= cast(checksum(newid(), id) & 0x7fffffff as float) 
/ cast (0x7fffffff as int) 

What's your thoughts on this?

*

Protected by WP Anti Spam