If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Batch file to run a list of .sql files

I've a list of .sql script files to create Stored Procedures. Currently to
create all these Stored Procedures in another machine, I've to open & run
one-by-one from the Query Analzyer. This becomes tedious when the no. grows.
Is there a way to create a batch file that run the scripts, something like
this :

Re: Batch file to run a list of .sql files

there are 2 ways to do this:
1) use SQL Distributed Management Objects to write an application that reads
the directory and runs scripts form it, for example
2) otherwise, you can create a DOS batch file that calls osql utility which
"allows you to enter Transact-SQL statements, system procedures, and script
files"
--
HTH,
David Satz
Principal Web Engineer
Hyperion Solutions
{ SQL Server 2000 SP2/6.5 SP5a } { Cold Fusion 5 SP1 } { VSS }
(Please reply to group only - emails answered rarely)
-----------------------------------------------------------------
"Ben" <bluebells88@yahoo.com> wrote in message news:3cde4379$1@10.1.10.29...
>
> I've a list of .sql script files to create Stored Procedures. Currently to
> create all these Stored Procedures in another machine, I've to open & run
> one-by-one from the Query Analzyer. This becomes tedious when the no.
grows.
> Is there a way to create a batch file that run the scripts, something like
> this :
>
> run script1.sql
> run script2.sql
> run script3.sql
> ...
> run scriptn.sql
>
> Thanks in advance,
> Ben
>
>