Author |
Topic |
jgrant
Yak Posting Veteran
69 Posts |
Posted - 2007-03-15 : 13:47:25
|
I want to automate a query that I am running everyday. So, what I want to do is run it at a particular time of the day say 11:00pm. Is this possible? Should I create a stored procedure? And also, I want to run an update statement on a particular table on the first of every month. If anyone can give me some advice on this, I would appreciate it.Jared |
|
snSQL
Master Smack Fu Yak Hacker
1837 Posts |
Posted - 2007-03-15 : 13:52:14
|
Create a scheduled job - the job can call a stored procedure or just run a batch of T-SQL so you can create a stored procedure, but it isn't necessary. |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-03-15 : 14:00:42
|
Yes. Create a JOB and have SQL Server Agent handle it for you.Peter LarssonHelsingborg, Sweden |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-03-15 : 14:01:32
|
Peter LarssonHelsingborg, Sweden |
|
|
jgrant
Yak Posting Veteran
69 Posts |
Posted - 2007-03-15 : 14:09:10
|
awesome. Also, if you guys have some free time, how can I check to see if the date is the first? @getdate = getdate() then: |
|
|
snSQL
Master Smack Fu Yak Hacker
1837 Posts |
Posted - 2007-03-15 : 14:17:47
|
When you create the job, just set the schedule to monthly and to run on the first of every month. You won't have to check the first of the month in your code.If you do want to the first of the month in your code it will just beday(getdate()) = 1 |
|
|
jgrant
Yak Posting Veteran
69 Posts |
Posted - 2007-03-15 : 14:33:14
|
Okay, this is off topic but I will say it anyway, whats up with the Yak? |
|
|
snSQL
Master Smack Fu Yak Hacker
1837 Posts |
Posted - 2007-03-15 : 14:39:56
|
I have no idea when it started, but I guess someone figured calling people SQL gurus was soooo booooring |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|