Click here to Skip to main content
15,893,487 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Getting This error when I am executing Stored procedure:

Steps which i DID
Steps:1) I have created A SP having with some temp tables
2)Getting data from XML file to insert into temp tables and doing update and Insert operations into Temp tables.
3)I have written
-----------------------
BEGIN TRY
BEGIN TRANSACTION
--insert and Update operations
END TRY
BEGIN CATCH
SET @errorMsg= ERROR_MESSAGE()
SET @IsSucess=0
ROLLBACK TRANSACTION
END CATCH

--------------------

This SP I am Executing Using SSIS Package JOB.

so getting bellow error

Error : Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 0, current count = 1

Can any one help me regarding this.
Posted
Updated 26-Aug-13 19:23pm
v3
Comments
Nelek 26-Aug-13 9:28am    
What have you tried?[^]
Please don't think we can read minds or do astral projections to see your monitor.
Use the widget "improve question" and add a bit more information and a piece of the code triggering the error. Otherwise is quite difficult to know where is the error

It means you are perhaps trying to rollback a transaction that does not exist or commit one that does not exist. You need to go through your SQL and see why that is happening.
 
Share this answer
 
try like this

BEGIN TRANSACTION
BEGIN TRY
--insert and Update operations
COMMIT TRANSACTION
END TRY
BEGIN CATCH
SET @errorMsg= ERROR_MESSAGE()
SET @IsSucess=0
ROLLBACK TRANSACTION
END CATCH
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900