Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have a stored proc that returns a count of number of rows from running a query. I want to schedule a job that runs this stored proc and emails people if count is 0.

how do I do this using SqlserverAgent-->jobs.

Many thanks .
Posted

 
Share this answer
 
Comments
thatraja 7-Mar-12 18:18pm    
5!
Not sure which version of SQL Server you are using. However you may find below information useful for this.

To send emails.
http://msdn.microsoft.com/en-us/library/ms175887.aspx

http://msdn.microsoft.com/en-us/library/ms190307.aspx

To craete a new Job and configure your Stored Procedure in the Job.
http://msdn.microsoft.com/en-us/library/ms190268.aspx

To schedule your Job.
http://msdn.microsoft.com/en-us/library/ms191439.aspx
 
Share this answer
 
Comments
thatraja 7-Mar-12 18:18pm    
5!
There is an easier way.

http://msdn.microsoft.com/en-us/library/ms190307.aspx[^]

I called this from a stored procedure and the response was immediate. I did not have to set up anything additional for this to work.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900