- For individual users
- Instant access to solutions
- Ask your tech questions
- Start your 30-day Free Trial
Main Topics
Browse All TopicsI'm creating a stored procedure that checks the quality of the data loaded into our data warehouse on a daily basis. Most of the table checks in the stored procedure run on a daily basis. However, some of the table checks only need to run once a month as they are tables that are only loaded once a month.
I was curious if it was possible within the stored procedure to set some kind of condition that would permit that particular block of code to only execute when the date value equalled the first of the month?
Thank you!
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: 8080_DiverPosted on 2009-07-13 at 20:32:47ID: 24846123
Why not check the system date's day of month to see if it is equal to a 1?
Of course, the issue would be, what if the system is down on the first through 3rd of the month? So, what I would suggest is a "cheat" that I use for various similar tasks that I have created. Create a simle little controlling table that has the task name, a last run date, a RunInterval, and a NextRun date or . Then you populate that table with the appropriate information and, in you process, you check to see if today is >= NextRunDate. If it is, then you execute that step in the process and, upon successful completion, update the Last Run Date and set the NextRunDate (of course, on a failure, you don't touch the control table row ;-). That way, you can see the date of the last successful run and then next scheduled Run Date. (If you want to get fancy, you can have a column for Days, one for Months, and one for Years to increment the NextRunDate. ;-)