July 28, 2006 at 5:17 am
Is there a way of having a TSQL script kicked off at a certain time? Alternatively, is it possible to have a Windows batch file call a TSL command (and then use Task Scheduler to call the batch file)?
July 28, 2006 at 5:37 am
Thats exactly what SQLAgent is doing !
Enterprise Manager / Management / SQLAgent / Jobs
Create a new job, add a jobstep containing your SQLscript, schedule it , et voilÃ
You'll have to check your sqlagent is running (and automaticaly starts after a reboot)
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
July 28, 2006 at 6:14 am
Outstanding alzdba ! That's exactly what I was looking for 🙂
July 31, 2006 at 6:37 am
On a sidenote, although you can write the SQL directly into the job step, because of performance, maitainability and reusability it is often to your advantage to create a stored procedure from your SQL script. The job step is very short in such situation, it just calls the procedure (EXECUTE procedure_name), possibly with some parameters.
August 1, 2006 at 10:57 am
I think that's what I did but being a noob i'm not sure: does this look OK:
http://static.flickr.com/59/204019468_e0eeff1752.jpg?v=0
Apologies for external link but a picture = 1000 words.
August 2, 2006 at 1:31 am
You have written the SQL directly int command window, but in this case it is OK - no need to use stored procedures with such simple commands. Maybe you could consider entering backup of each database (or group of databases) as a separate step. It gives you more control over the backups.
Stored procedures and views are really helpful if you want to schedule checks (e.g. list of orders not processed in X days) and send results to responsible persons by mail on a regular basis, or summarize daily/weekly/monthly data for easier querying.
August 2, 2006 at 3:10 am
Yes, it's a simple set of commands but that leads me to another question: I'd originally saved the backup job as a .sql file and ran it manually.
How can I hook a .sql file into SQL server agent?
Thanks again...this isn't covered in my book 😉
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply