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)
 Can multiple SPs be wrapped in one transaction?

Author  Topic 

ygeorge
Yak Posting Veteran

68 Posts

Posted - 2003-06-19 : 12:22:26
Let's say I have several stored procedures -

sp1
sp2
sp3

Can I do something this -

begin transaction
exec sp1
exec sp2
exec sp3
commit

So that if anyone of them failed, whole transaction would be rollback.

Thanks,

George

setbasedisthetruepath
Used SQL Salesman

992 Posts

Posted - 2003-06-19 : 12:31:44
Yes you can, but bear in mind that rollbacks are not automatic. You need to check for errors with @@error and issue an explicit ROLLBACK if they occur.

Jonathan
{0}
Go to Top of Page

ygeorge
Yak Posting Veteran

68 Posts

Posted - 2003-06-19 : 12:43:02
Thanks.

George

Go to Top of Page
   

- Advertisement -