Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling multiple SQL (.sql) scripts

Status
Not open for further replies.

Guest_imported

New member
Joined
Jan 1, 1970
Messages
0
All

Does anyone have a section of code that will open and execute a series of SQL scripts from something like a DOS batch file. I'd rather not combine all the scripts into one and execute them as a procedure. They are currently stored as .sql files

If you've any ideas they'd be most appreciated

Mark
 

You can create a BAT file that excutes a series of OSQL statements. Each OSQL execution can execute the statements in a SQL file.

OSQL /Sservername -E -iC:\MSSQL7\SQL\script1.sql -oC:\MSSQL\Logs\script1.log
OSQL /Sservername -E -iC:\MSSQL7\SQL\script2.sql -oC:\MSSQL\Logs\script2.log
OSQL /Sservername -E -iC:\MSSQL7\SQL\script3.sql -oC:\MSSQL\Logs\script3.log Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top