If I have this sproc:
create procedure dbo.test_tran
as
begin
begin tran
create table #temp ( iID INT )
INSERT INTO #temp ( iID ) VALUES ( 1)
rollback
end
And I run this code from a query window:
BEGIN TRAN
EXEC dbo.test_tran
ROLLBACK
Why do I get this output?
(1 row(s) affected)
Msg 266, Level 16, State 2, Procedure test_tran, Line 6
Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 1, current count = 0.
Msg 3903, Level 16, State 1, Line 3
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION