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
 General SQL Server Forums
 New to SQL Server Programming
 Call Stored Procedure From another SP

Author  Topic 

1sabine8
Posting Yak Master

130 Posts

Posted - 2007-12-11 : 05:31:07
Hi, i wanna know if we can call a stored procedure from another one. If yes, what's the syntax?
Thanks

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-12-11 : 05:36:45
Create procedure procname
as
...
..
EXEC other_proc


But it depends on what other procedure is doing

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

kiruthika
Yak Posting Veteran

67 Posts

Posted - 2007-12-11 : 06:23:20
quote:
Originally posted by 1sabine8

Hi, i wanna know if we can call a stored procedure from another one. If yes, what's the syntax?
Thanks




Hi!

alter proc mypro @custname varchar(20)
as
begin
begin
select cust_name,cust_id from customer where cust_name like @custname
end
--exec sp_help exproc
exec exproc 9000
end

here mypro and exproc are procedures.You can execute system stored procedures also.(Uncomment the line and execute sp_help line also)
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-12-11 : 06:34:17
Also asked and answered here http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=94015



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -