Running Multiple scripts. | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Running Multiple scripts.

Sorry 4 asking too many questions this week.But i need to know is there a way i can run multiple scripts automatically
e.g script1.sql then script2.sql.
Basically can you write a script to execute other scripts.
One way is to create a job which will call the DTS and schedule it so that it runs automatically. In DTS create activex script to read the files in your folder one by one and execute them using ADO.
You can have all the scripts in a single Stored Procedure and schedule it as job to run periodically Madhivanan Failing to plan is Planning to fail
Take your time to read the books online about stored procedures and scheduling the jobs on SQL server. & fyi. Satya SKJ
Microsoft SQL Server MVP
Contributing Editor & Forums Moderator
This posting is provided “AS IS” with no rights for the sake of knowledge sharing.
Typically if these scripts are to be run periodically, and are not just one-off operations, you would put them in stored procedures. You can then have a wrapper procedure which calls each procedure in turn create procedure dbo.wrapperProc
exec dbo.proc1
exec dbo.proc2
You might also want to read about good error handling, @@ERRORCODE and transactions