Link to home
Start Free TrialLog in
Avatar of MelissaC
MelissaC

asked on

Query Analyzer: Run sequence of files

Hi All,

I want to create a script that says:

- Run scriptfile 1  (create database script)
- Run scriptfile 2  (create stored procedures script)
- Run scriptfile 3  (fill database script)

What is the syntax for this?
Avatar of Lowfatspread
Lowfatspread
Flag of United Kingdom of Great Britain and Northern Ireland image

basically...

osql.exe -dDatabaseName -E -iInputfile -oOutputfile -SserverName


for the create database specify Master or Tempdb as the database

use -E for a trusted connection or -Uuserid -Ppassword for  a sql server login...

invoke osql 3 times once for each script type...

Avatar of MelissaC
MelissaC

ASKER

OK, so I can create a .bat file to do this. But isn't there a way to say it in a sql-script file?
Some kind of <execute file> statement or something?
ASKER CERTIFIED SOLUTION
Avatar of Dishan Fernando
Dishan Fernando
Flag of Malaysia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial