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)
 how to execute a sp in another sp?

Author  Topic 

rammohan
Posting Yak Master

212 Posts

Posted - 2009-09-14 : 06:42:12
hi i have a procedure with name sp1,it has three input paameters and some insert logic in it.
now i want to create another ap with name sp2, in that sp2 i want to execute sp1 by supplying the input parameters of sp2 to sp1.
pls suggest me a way

ihad written
create procedure msp_sp2
@val1,@val2,@val3
as
begin
exec msp_sp1(@val1,@val2,@val3) //error here :Incorrect syntax near '@val1'.

pls help

end

One can never consent to creep,when one feels an impulse to soar
RAMMOHAN

matty
Posting Yak Master

161 Posts

Posted - 2009-09-14 : 06:56:25
Brackets are not required.

exec msp_sp1 @val1,@val2,@val3

quote:
Originally posted by rammohan

hi i have a procedure with name sp1,it has three input paameters and some insert logic in it.
now i want to create another ap with name sp2, in that sp2 i want to execute sp1 by supplying the input parameters of sp2 to sp1.
pls suggest me a way

ihad written
create procedure msp_sp2
@val1,@val2,@val3
as
begin
exec msp_sp1(@val1,@val2,@val3) //error here :Incorrect syntax near '@val1'.


pls help

end

One can never consent to creep,when one feels an impulse to soar
RAMMOHAN



Go to Top of Page

rammohan
Posting Yak Master

212 Posts

Posted - 2009-09-14 : 07:00:07
thank u

One can never consent to creep,when one feels an impulse to soar
RAMMOHAN

Go to Top of Page
   

- Advertisement -