Hi,
This is what I am doing. Basically I want all inserts and deletes to run, or not at all.
This code seemed to work fine in 2005. I don't know if anything has changed in 2008, but I'm getting the following error:
Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 0, current count = 1.
I really don't understand what the problem is!
Any ideas greatly appreciated!!!
Thank you
This is what I am doing. Basically I want all inserts and deletes to run, or not at all.
Code:
CREATE PROC myProc
AS
BEGIN
BEGIN TRAN
BEGIN TRY
insert to table x...
insert to table y...
insert to table z...
delete table a...
END TRY
BEGIN CATCH
do something...
END CATCH
IF @@TRANCOUNT > 0
COMMIT TRAN
END
This code seemed to work fine in 2005. I don't know if anything has changed in 2008, but I'm getting the following error:
Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 0, current count = 1.
I really don't understand what the problem is!
Any ideas greatly appreciated!!!
Thank you