Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 scripting for sql job?

Author  Topic 

Dennis Melahn
Starting Member

2 Posts

Posted - 2009-05-27 : 13:29:14
One of our apps requires that I occationally use query analyzer to run a short script against a specific db to truncate tables prior to running update jobs (jobs in sql server agent). Is there a way to automate this? (1. selecting the correct db, 2. running the 4 line script below.)

USE BIO
Truncate Table BIOFact
GO
Truncate Table BIOLog
GO
Truncate Table BIOStepLog
GO

Thanks,
Dennis

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-05-27 : 13:30:03
what determines which are tables to truncated and in what db?
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-05-27 : 13:38:14
You can add a new step in the job, before the current step, and add the code above.
Make sure job starts with the new first step.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

Dennis Melahn
Starting Member

2 Posts

Posted - 2009-05-27 : 14:05:48
I want this to run prior to the update jobs so should I create a job that starts about 10 minutes prior and in Step 1 select the correct db and paste these lines into the Command window?

Thanks for your help,
Dennis




quote:
Originally posted by Peso

You can add a new step in the job, before the current step, and add the code above.
Make sure job starts with the new first step.



E 12°55'05.63"
N 56°04'39.26"


Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-05-27 : 14:06:59
No. SAME job but new jobstep.


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page
   

- Advertisement -