Considering the following example
Procedure1
..........
IF(@errorcode<>0) ROLLBACK TRANSACTION
ELSE COMMIT TRANSACTION
SELECT @errorcode
Procedure2
..........
WHILE [condition] BEGIN
EXEC @proc1result = Procedure1 [parameters]
IF(@proc1result=0) SET @totalresult=@totalresult+1
END
SELECT @totalresult
The problem is that @totalresult is incremented correctly but the value returned by Procedure2 is 0. How to get it right?
I am using sql server 2008 and Entity Framework 4. Procedure1 works well.