I want to call a SP from another SP. I know I can easily call it. But Problem is, if an error occurs in SP2 then I want to ROLLBACK SP1.
SP1
BEGIN Tran
[Some Code]
Call to SP2
[Some Code]SP2
BEGIN TRAN
[Some Code]
[Error Comes]
ROLLBACK TRAN
This would rollback Tran in sp2 only. I want to RollBack SP1 as well, if an error occurs in sp2.
Any help would be appreciated.
Seems people have issues with other information sites…
The gist of it is that the parent procedure will through an exception when trying to perform a ROLLBACK as the child already has. The way around this is to have the parent check the @trancount before committing.
http://forums.asp.net/t/1259708.aspx