Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get a Random Sample of 10%.

Status
Not open for further replies.

brendasql

Programmer
Apr 1, 2003
58
US
I am trying to retrieve a list for a random audit of new entries in our database. The list (report) needs to be 10% of the total new entries. I have written a store proc to retrieve my number for the 10%, but I'm having a hard time trying to input this into another store proc or in VB6 code. My users will be generating this report each week using these procedures. Any help would be greatly appreciated!!!!!!!
Thanks,
B
 
Try this

select top 10 percent * from tbname order by newid()
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top