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.
| Author |
Topic |
|
fmardani
Constraint Violating Yak Guru
433 Posts |
Posted - 2006-03-06 : 11:45:57
|
| I have created three stored procedures.Each one has a begin transaction and commit transaction and in the begin catch statement it has rollback transaction.i.e.create procedure sp1asbegin trybegin transaction insert into table1(field1) values('field1') insert into table2(field2) values('field2')end transactionend trybegin catch rollback transactionend catch--------------------------------create procedure sp2asbegin trybegin transaction insert into table3(field3) values('field3') insert into table4(field4) values('field4')end transactionend trybegin catch rollback transactionend catch--------------------------------create procedure sp3asbegin trybegin transaction insert into table2(field5) values('field5)' insert into table2(field5) values('field5)'end transactionend trybegin catch rollback transactionend catch---------------------------------NOW I would like to create one stored procedure to call the above three proceduresi.e.create procedure spMainasbegin trybegin transaction execute sp1 execute sp2 execute sp3end transactionend trybegin catch rollback transactionend catch???????????????????????????????is what I have done correct for spMain ?It's just that in each individual SP there is rollback transaction. I have also placed it in the catch statement for spMain.My concern is that what happens if there is an error in spMain say in exececute sp3 ?Thanks |
|
|
|
|
|