views:

370

answers:

2

How do I schedule a stored procedure in Sql Server 2005 that it runs once at the start of every month (and on database startup)?

+6  A: 

You will need to create a job using the SQL Server Agent.

Chris Porter
Yup. And test it. Question - whats it going to do? Clean up some tables?
Kris Krause
It's going to delete suspended datasets (employees whose job contract 'expired')...
Quandary
+3  A: 

In SSMS, go expand the SQL Server Agent node under the DB server, right click the "Jobs" folder and select "New job...". That will take you through a wizard to schedule a sproc to run on whatever schedule you want.

In terms of how to get a sproc to run on db startup, see this article.

AdaTheDev
+1, use job and run on startup
KM