Re: Running multiple sql statements from one Stored procedure
From: Hugo Kornelis (hugo_at_pe_NO_rFact.in_SPAM_fo)
Date: 09/21/04
- Next message: David Portas: "Re: Back up on remote computer."
- Previous message: Geoff N. Hiten: "Re: Back up on remote computer."
- In reply to: Rob: "Running multiple sql statements from one Stored procedure"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 21 Sep 2004 21:43:48 +0200
On Tue, 21 Sep 2004 12:37:18 -0400, Rob wrote:
>I created each in a procedure
>but would like to combind into one stored procedure, not sure if this can be
>done.
Hi Rob,
Sure it can be done. There several options available:
1. Keep the current procs, add one wrapper proc that calls them all:
CREATE PROC Combined
AS
EXEC Proc1
EXEC Proc2
EXEC Proc3
go
2. Create one proc that contains the code from all other procs:
CREATE PROC Combined
AS
Code from Proc1,
you can use copy and paste
to get it all in
Code from Proc2,
you can use copy and paste
to get it all in
Code from Proc3,
you can use copy and paste
to get it all in
go
In both cases, you might want to add error handling. You might also want
to enclose everything in a transaction, so you won't be left with partial
results if anything goes wrong. (Explanation: without transaction, if
Proc3 goes wrong results from Proc3 are rolled back, but results from
Proc2 and Proc1 will remain in the database. With transaction, all changes
from all procs will be rolled back if anything goes wrong).
Best, Hugo
-- (Remove _NO_ and _SPAM_ to get my e-mail address)
- Next message: David Portas: "Re: Back up on remote computer."
- Previous message: Geoff N. Hiten: "Re: Back up on remote computer."
- In reply to: Rob: "Running multiple sql statements from one Stored procedure"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|