• Register
0 votes

Problem :

My Stored Procedure is giving me following error
transaction count after execute indicates a mismatching number of begin and commit statements
6 5 3
6,930 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

This usually happens when one transaction is started and either it is not committed or it is not rolledback.

If the error comes in your stored procedure then it will lock the database tables as the transaction is not completed due to some runtime errors occuring in the absence of exception handling. So to avoid getting such errors you can use the Exception handling as shown below. 

SET NoCount ON
Begin Try 
        //Insert ,update queries    
End Try 
Begin Catch 
End Catch

Further Readings :


9 7 4
38,600 points

Related questions

0 votes
1 answer 110 views
Problem : I am facing following error with the below query in SQL Server 2012. An expression of non-boolean type specified in a context where a condition is expected, near 'RETURN'. SQL Query: CREATE FUNCTION [dbo].[GetMYPMResources](@UserResourceNo ... JOIN JobTask t ON t.JobTaskNo = m.JobTaskNo WHERE t.TaskManagerNo = @UserResourceNo OR t.AlternateTaskManagerNo = @UserResourceNo ) RETURN END
asked Dec 4, 2019 alecxe 7.5k points
0 votes
1 answer 11 views
Problem: I am a beginner to sql. I have the 123MB sql file which I am trying to execute on my local PC. But I am facing the below error: Cannot execute script: Insufficient memory to continue the execution of the program. Whenever I click on Ctlr+E then it ... above error. I have tried to fix the above sql error with the help of online tutorials but they were not useful in fixing the error.
asked Aug 28, 2020 Raphael Pacheco 4.9k points
1 vote
1 answer 92 views
Problem : My task is to send email with the file attachments also this attachment must come from the image type data field. If I try to run the below code in both the query window and the stored procedure but my email was not sent and in the query window I can only see ... = 1,     @query_no_truncate = 1; I need to send email but still unable to do so. I am looking for help in fixing the issue.
asked May 6, 2020 stewart 4k points
0 votes
2 answers 205 views
Problem: A(n) ____ in a class diagram indicates public access?
asked Apr 12, 2020 ArifulIslam 5.6k points
0 votes
1 answer 207 views
Problem : I don't understand why I am unable to insert this. I can't spot any problem. The error message is as below : Conversion failed when converting from a character string to uniqueidentifier. A GUIDs are the ... Server 2012 The columns are as below id        uniqueidentifier, myid      uniqueidentifier, friendid  uniqueidentifier, time1     datetime nullable, time2     datetime nullable
asked Jan 17, 2020 jwilliam 3.9k points
0 votes
1 answer 42 views
Problem: I am little bit confused, which statement is true? Which of the following statements is true of Extensible Markup Language (XML)? XML documents are utilized for displaying graph structures. XML documents can handle data in graphs with multiple root ... as well as doing nothing without having any predefined tags. XML tags represent the kind of content being posted and transmitted
asked Feb 19, 2020 maddi86 5.4k points
0 votes
1 answer 32 views
I want to count lines, words and characters from a file. I'm having a problem counting the right amount of characters and words.
asked Oct 20, 2020 Ahsan 1.8k points
0 votes
1 answer 24 views
Problem: I have recently started learning the C Programming. Currently I am trying to write C programs. In this coding problem I am trying to count the number of characters, newlines and number of words. But I think there is some issue in the second while loop which I am unable to ... ();                 nc++;             }             nc++;         }     }     printf("%d %d %d",nl,nc,nw); }
asked Jun 16, 2020 Raphael Pacheco 4.9k points