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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Execute Stored Procedure only on certain dates 1

Status
Not open for further replies.

RJL1

Technical User
Oct 3, 2002
228
US
I have a need to schedule a StoreProcedure to run but only on the 15th of every month. I have the Store Procedure scheduled to run every day using the SQL Server agent under Jobs. However as stated I liek to chaneg this to run only on the 15th of every month. I know that within the job schedulers in SQL there is no option to pick the 15th of every month but is there a way to put it in the stored procedure that is the current day is equalto the 15th then run else do not execute?

I'm thinking this way I could have it run every day but it would only actually executeo when the day = the 15th

Thanks for any help
 
Put this at the top of your stored procedure:

Code:
If Day(GetDate()) <> 15 
	Return


-George
Microsoft SQL Server MVP
My Blogs
SQLCop
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
gmmastros as always great solution. So simple it works great

Thanks
 

You can schedule jobs to run on any day of the month.

Go to your job, Edit the schedule, set the frequency to occurs monthly and then change it to the 15th of each month.





I love deadlines. I like the whooshing sound they make as they fly by
Douglas Adams
(1952-2001)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top