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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2003-07-23 : 07:27:27
|
| eswar writes "I have a main stored Procedure which is calling three stored procedures consecutively inside the Main.If any error occured the entire transaction should roll back.So I am checking the if @@error after the exectuion of each stored procedure and redirecting to erorhandle by using goto label;But I am getting the following errorThe ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTIONHow to resolve this.Thanks in advanceRegardsPrabhakar" |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2003-07-23 : 09:19:37
|
| Do this..DECLARE @rc intEXEC @rc = EXEC sprocinside the sproc return a value other than 0 to determine if the sproc was successful or not...Brett8-) |
 |
|
|
mohdowais
Sheikh of Yak Knowledge
1456 Posts |
Posted - 2003-07-23 : 09:39:12
|
| You could also check if the currently open transactions have been rolled back by one of the inner stored procs or as a result of an error, before you issue the ROLLBACK TRAN Statement. The @@TRANCOUNT global variable comes in handy here:IF (@@TRANCOUNT > 0 AND @@ERROR <> 0)BEGIN ROLLBACK TRAN RETURN -1ENDOwais |
 |
|
|
|
|
|