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 2000 Forums
 SQL Server Development (2000)
 How can I execute a SP from another SP

Author  Topic 

PeterG
Posting Yak Master

156 Posts

Posted - 2002-11-29 : 18:33:15
I have SP1 that I'd like to run from within another sp SP2:

Create stored procedure SP2....

...do some stuffs here

if @variable = '1'
... execute SP1 passing all the params required by SP1

...continue with other stuffs here


What's the syntax for doing this? Thanks.



SamC
White Water Yakist

3467 Posts

Posted - 2002-11-29 : 19:06:20
There are several good articles on this website.

Try the search feature on sqlteam home page

To answer your question, it depends on whether the procedure you are calling returns anything.

exec dbo.myprocedure @Parm1=@Parm1, @Parm2='another parm'

will do just fine. If a return parameter is expected, visit

[url]http://sqlteam.com/item.asp?ItemID=2644[/url]

There are other articles that cover how to handle a return recordset.

Sam

Go to Top of Page
   

- Advertisement -