October 15, 2007 at 8:50 am
I want to create a script, Master.sql, that looks something like this:
...
Begin Transaction
Execute ( c:\..\ .....\ file1.sql)
Execute ( c:\..\ .....\ file2.sql)
End Transaction
But I can't figure out how to execute the "sql" files from the script.
TIA,
Barkingdog
October 15, 2007 at 8:55 am
use osql
[font="Comic Sans MS"]The GrumpyOldDBA[/font]
www.grumpyolddba.co.uk
http://sqlblogcasts.com/blogs/grumpyolddba/
October 15, 2007 at 9:02 am
I don't know how we can directly execute a script within another script?
But here is, one of the ways which i used to execute a list of files from a batch file using osql utility..
ECHO OFF
CLS
SET FilePath=C:\MySQLFiles\*.sql
SET MyServer=NameOfTheServer
SET MyLogin=LoginName
SET MyPassword=Password
SET MyDatabase=DefaultDB
FOR %%i IN (%FilePath%) DO osql -S%MyServer% -U%MyLogin% -P%MyPassword% -d%MyDatabase% -i%%i -o%%i.log
--Ramesh
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply