September 24, 2008 at 10:51 am
I need to select random 5% rows from 100 records. The Select Top (5) percent gives me the first 5 rows. I want a random 5% but not in order. Any suggestions ?
September 24, 2008 at 11:00 am
September 24, 2008 at 11:09 am
Even easier use the TABLESAMPLE funciton in sql 2005
select * from MyTable tablesample(5 percent)
there are some limitations on this though check BOL, the smaller the number of rows in your table the less accurate the % sample will be.
September 24, 2008 at 11:21 am
thanks but this did not get 5%
September 24, 2008 at 11:28 am
thanks..this worked
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply