RE: is there a way to call sql script from inside of sql

RE: is there a way to call sql script from inside of sql

 

  

To add to the prior mail.You can also use a batch file executing each
scripts one after the other using the Isql command.

Deepak

-----Original Message-----
From: Deepak Nair [mailto:Deepak.[Email Address Removed] Thursday, May 23, 2002 12:48 PM
To: 'Bill Conner'; [Email Address Removed] Todd Benge
Subject: RE: is there a way to call sql script from inside of sql


Hi Bill

Try this example:

Declare @Sql NVarchar(1000)
Declare @Table varchar(40)

Set @Table='TabA'
Set @Sql=N'Select * from '+@Table

exec sp_executesql @Sql

I hope this helps

Deepak
DBA
Gator Corporation
(650) 232 0367




-----Original Message-----
From: Bill Conner [mailto:bill.[Email Address Removed] Thursday, May 23, 2002 12:13 PM
To: [Email Address Removed] Todd Benge
Subject: Re: is there a way to call sql script from inside of sql


What i have is a sql script that builds tables and other objects and what i
need
is to be able to run other filename.sql scripts in side of the first. For
instance in oracle
i make an installer.sql and do this:

@createtable.sql
@altertable.sql
@select.sql
@insert.sql
@delete.sql
etc.....

from inside the install.sql so instead of having one really huge
sql script i have many smaller ones that all get run from another
filename.sql.


At 11:55 AM 5/23/2002 -0700, Parag Kulkarni wrote:
>What I meant to say is
>
>For example you have a Stored Procedure GetUsers and
>you want to execute some other stored
>procedure,GetEmployeesInfo , which u need inside
>GetUsers
>
>Then inside Getusers stored procedure you write a
>command like
>Exec GetEmployeeInfo.
>
>I hope thats what you wanted.
>
>
>
>--- Bill Conner <bill.[Email Address Removed] wrote:
> > It says "could not find stored procedure
> > 'ScriptName' " and aborts out of
> > the main script.
> >
> > At 11:12 AM 5/23/2002 -0700, Parag Kulkarni wrote:
> > >Yes you can do it by the syntax below
> > >
> > >Exec ScriptName
> > >
> > >
> > >
> > >
> > >
> > >--- Bill Conner <bill.[Email Address Removed] wrote:
> > > > Hi All,
> > > >
> > > > Is there any way to execute a sql script from
> > inside
> > > > of sql script?
> > > >
> > > > Thanks,
> > > >
> > > > -bill
> > > >
> > > >
> > > >
> > > >
> >
> >---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > > > mssqldba-[Email Address Removed] > > > For additional commands, e-mail:
> > > > mssqldba-[Email Address Removed] > > >
> > >
> > >
> > >__________________________________________________
> > >Do You Yahoo!?
> > >LAUNCH - Your Yahoo! Music Experience
> > >http://launch.yahoo.com
> > >
> >
> >---------------------------------------------------------------------
> > >To unsubscribe, e-mail:
> > mssqldba-[Email Address Removed] > >For additional commands, e-mail:
> > mssqldba-[Email Address Removed] >
> >
> >
> >
>---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > mssqldba-[Email Address Removed] > For additional commands, e-mail:
> > mssqldba-[Email Address Removed] >
>
>
>__________________________________________________
>Do You Yahoo!?
>LAUNCH - Your Yahoo! Music Experience
>http://launch.yahoo.com
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: mssqldba-[Email Address Removed] additional commands, e-mail: mssqldba-[Email Address Removed] unsubscribe, e-mail: mssqldba-[Email Address Removed] additional commands, e-mail: mssqldba-[Email Address Removed] unsubscribe, e-mail: mssqldba-[Email Address Removed] additional commands, e-mail: mssqldba-[Email Address Removed]MS Sql Server LazyDBA home page