Call a stored procedure in another stored procedure

Call a stored procedure in another stored procedure

Post by Federic » Thu, 01 May 2003 23:20:36



Hi,

I dont know how to call a stored procedure from another
stored procedure. I know it can be done but im a rookie
with sql server programming.

thank you

 
 
 

Call a stored procedure in another stored procedure

Post by Vinod » Thu, 01 May 2003 23:31:50


Inside the first SP use the EXEC to call the second SP.

Create proc SP1
As
...
...
Exec SP2 ,,,
...
...

--
HTH,
Vinod Kumar
MCSE, DBA, MCAD
SCT Software Solutions

Hi,

I dont know how to call a stored procedure from another
stored procedure. I know it can be done but im a rookie
with sql server programming.

thank you

 
 
 

Call a stored procedure in another stored procedure

Post by Vishal Parka » Thu, 01 May 2003 23:28:20


Use following syntax

exec <sp_name> param1,param2

--Vishal

Quote:>-----Original Message-----
>Hi,

>I dont know how to call a stored procedure from another
>stored procedure. I know it can be done but im a rookie
>with sql server programming.

>thank you
>.

 
 
 

Call a stored procedure in another stored procedure

Post by Keith Kratochvi » Thu, 01 May 2003 23:33:19


...and if you need to use the results from one stored procedure in another stored procedure you have to create the temporary table first

as in

create table #foo (col1 datatype, col2 datatype, col3 datatype....)

Then you can use #foo in your main stored procedure

--
Keith, SQL Server MVP

Inside the first SP use the EXEC to call the second SP.

Create proc SP1
As
...
...
Exec SP2 ,,,
...
...

--
HTH,
Vinod Kumar
MCSE, DBA, MCAD
SCT Software Solutions

Hi,

I dont know how to call a stored procedure from another
stored procedure. I know it can be done but im a rookie
with sql server programming.

thank you

 
 
 

Call a stored procedure in another stored procedure

Post by Tony Rogerso » Thu, 01 May 2003 23:42:51


Use EXEC

eg.

EXEC myproc

--
Tony Rogerson
SQL Server MVP
http://www.sqlserverfaq.com?mbr=21
(Create your own groups, Forum, FAQ's and a ton more)