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 2005 Forums
 Transact-SQL (2005)
 running a sql script

Author  Topic 

jamie
Aged Yak Warrior

542 Posts

Posted - 2007-03-13 : 06:30:44
hi, is it possible to run a file test.sql from QA without clicking on file , open ?
also my test.sql looks like :

exec sql1.sql
go
exec sql2.sql
go

is this possible or will I need to copy all scripts into one file ?

Kristen
Test

22859 Posts

Posted - 2007-03-13 : 07:16:58
SQL Server includes a command line tool, OSQL.EXE, that can run the individual files - e.g. from a BATCH file.

There isn't an "include" directive [in OSQL] as far as I know, but in a BATCH file you could do something like:

FOR %%f IN (x:\mypath\*.SQL) DO OSQL %%f

(You'll need a bunch of parameters to OSQL for servername, userid & password, etc.)

Kristen
Go to Top of Page

jamie
Aged Yak Warrior

542 Posts

Posted - 2007-03-14 : 07:07:08
Thanks alot Kristen
Go to Top of Page
   

- Advertisement -