Re: ISQL - Executing Multiple sql files

From: Govardhan MV (GovardhanMV_at_discussions.microsoft.com)
Date: 03/01/05


Date: Mon, 28 Feb 2005 20:47:02 -0800

HI Dan Guzman,

Thanks for the reply... but it is not solving my problem..

I am looking some thing like this, which we do it on oracle..
file master.sql contans
@test1.sql
/
@test2.sql
/
@test3.sql
...
@test20.sql

onces i exeute the master.sql file it executes all the files from test1.sql
.. 20.sql..
which help me in the instalation process. i am looking some thing like this
form
OSQL - ISQL ..

i give one file to the instalation guys and thing are done..

1) can we do the same thing in OSQL or ISQL...,
2) onces i login how do we execute the files.. what is the replacement for @
in MS-sql..

Regards
Govardhan MV

"Dan Guzman" wrote:

> To add to Tibor's response, you can execute all the script files in a given
> directory with a FOR command:
>
> FOR %f IN (*.sql) DO OSQL -E -d MyDatabase -i %f
>
> You could also execute all the files in a 'list' file:
>
> FOR /F "tokens=1" %f IN (ScriptList.txt) DO OSQL -E -d MyDatabase -i %f
>
> You'll need to double-up the '%' if the command is included in a BAT file.
>
> --
> Hope this helps.
>
> Dan Guzman
> SQL Server MVP
>
> "Govardhan MV" <Govardhan MV@discussions.microsoft.com> wrote in message
> news:3D7CD711-2C77-4296-A0EF-A604D2E92D75@microsoft.com...
> > Hi,
> >
> > I have 20 sql file which contains functions and procedure,
> > for example
> > test1.sql , test2.sql , test3.sql ..... test20.sql
> >>>I want one file to call the above all files.
> >
> > i can execute one file like this "isql -S servername - U sa - P xx -i
> > test1.sql" so i have repeat this commant for each files.
> >
> > Weather is it posible to put all this files name in one file and call that
> > file only
> >
> > Please do let me know weather this is posible or not through MS-sql ISQL
> > utiltiy...
> >
> > Regards
> > Govardhan MV
>
>
>



Relevant Pages