Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 statistics for stored procedure

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-07-13 : 07:51:28
shereen writes "I have a database that has the names of people who could participate in surveys...
I need to randomly select 20% of the people who are active to participate in a survey...
in the table, i have a field for the people name, active "which means if yes, the person is willing to participate in the survey, otherwise, he does not"
I need to select 20% of the those active people randomly, and then send them the survey....
Can you please show me how to create the stored procedure that would do such statistics?
thanks"

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-07-13 : 07:57:46
[code]select top 20 percent name from yourTable
where active='Yes' order by newid()[/code]

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -