Home > Archive > MS SQL Server > October 2005 > REQ: SPROC Selects % of Random Records









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author REQ: SPROC Selects % of Random Records
Bac2Day1

2005-10-28, 11:23 am

tbl_Information
-ID (int)
-info1 (varchar)
-info2 (varchar)
-info3 (varchar)
-location (int)
-handled (bit)
-stamp_entered (datetime)
----------------

Hopefully I can explain this correctly. I need to create a SPROC that
SELECTS a random 7% of the records within a date range in each
location. So hypothetically:

SELECT RAND() TOP 7% ID, info1, location
FROM tbl_Information
WHERE stamp_entered BETWEEN '10/25/2005' AND '10/28/2005 23:59:59'
GROUP BY location

One other catch. The 7% must first include all records within the date
range where handled = 1. Then what ever percentage of total records
within that date range that are not handled... select those, for each
location.

Email me if I'm still not fully clear (gregory_taylor@dell
.com).
Thanks!

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com