Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 ERROR Message

Author  Topic 

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-02-26 : 03:05:57
Hi,

Please help me to resolve this issue...
We have Triggers and also some procedures....
We are calling some procedures inside a procedure...

Somewhere it is causing this error:
Please let me know the fix for this issue
Msg 266 Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 1, current count = 0.

--
Chandu

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-02-26 : 03:17:57
i think you've not included the logic in inner procedures to rollback transaction upon all possible error condition. If over 2005 put TRY CATCH around the logic

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-02-26 : 03:42:38
Yes we have included TRY..CATCH in each Procedure....



--
Chandu
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-02-26 : 03:45:17
and have you added code to ROLLBACK inside CATCH block the open transactions

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-02-26 : 03:49:52
we just removed all BEGIN TRAN statements inside procedures...
They have added that TRAN code from front-end now....

Then also same problem raising.....

--
Chandu
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-02-26 : 22:33:56
hmm..I've seen the above message mostly in cases where transaction were not closed (commit/rollback) properly

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-02-27 : 00:29:54
we just removed all BEGIN TRAN statements inside procedures...
They have added that TRAN code from front-end now....

This is working fine now...

--
Chandu
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-02-27 : 00:31:44
ok...i assume the issue might have been with nesting of transactions inside procedures

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-02-28 : 09:14:53
May be... I want to know the usage of BEGIN TRAN.. COMMIT/ROLLBACK functionalities..
Share me links for that..

Thank u

--
Chandu
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-02-28 : 09:55:26
quote:
Originally posted by bandi

May be... I want to know the usage of BEGIN TRAN.. COMMIT/ROLLBACK functionalities..
Share me links for that..

Thank u

--
Chandu


Look into books online

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-03-01 : 07:38:37
quote:
Originally posted by bandi

May be... I want to know the usage of BEGIN TRAN.. COMMIT/ROLLBACK functionalities..
Share me links for that..

Thank u

--
Chandu

What I routinely use are the two examples (b) and (c) - mostly (c) - on this page: http://msdn.microsoft.com/en-us/library/ms175976.aspx

Go to Top of Page

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-03-01 : 08:29:12
quote:
Originally posted by James K

Thank you James

--
Chandu
Go to Top of Page
   

- Advertisement -