October 18, 2013 at 5:25 am
Can anybody point me at a good guide to using nested procedures please? There's a lot on the web but it all seems to assume background knowledge of using them. Books Online just says that you can call one proc from within another but doesn't explain how or give examples of syntax.
I'm confused by the fact that all the articles and examples seem to have some element of creating procs. It seems if I want to call a proc that's already there then I shouldn't necessarily have to create anything.
I'm pretty sure I'm missing something really obvious but I'm stumped.
How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537
October 18, 2013 at 6:52 am
It's simply a matter of executing the procedure inside your stored proc.
CREATE PROCEDURE MyNewProc
AS
EXEC AlreadyExistingProc;
GO
If you need to manipulate the data returned from a stored proc you can use a temp table
CREATE PROCEDURE MyNewProc
AS
CREATE TABLE #MyTemp (ColumnList);
INSERT INTO #MyTemp
EXEC AlreadyExistingProc;
GO
October 18, 2013 at 7:03 am
That, Sean, is exactly what I wanted. I had a feeling it was something as simple and straightforward as that. With all the flim-flammery around many of the examples and explanations it was hard to make it out though.
Within thirty seconds of your answer I'd got the proc I wanted to provide the result I wanted. The fact it's not the result I needed is for another question.
Thanks for your help.
How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply