SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 ERROR Message
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

bandi
Flowing Fount of Yak Knowledge

India
2210 Posts

Posted - 02/26/2013 :  03:05:57  Show Profile  Reply with Quote
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

India
52317 Posts

Posted - 02/26/2013 :  03:17:57  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

India
2210 Posts

Posted - 02/26/2013 :  03:42:38  Show Profile  Reply with Quote
Yes we have included TRY..CATCH in each Procedure....



--
Chandu
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 02/26/2013 :  03:45:17  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

India
2210 Posts

Posted - 02/26/2013 :  03:49:52  Show Profile  Reply with Quote
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

India
52317 Posts

Posted - 02/26/2013 :  22:33:56  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

India
2210 Posts

Posted - 02/27/2013 :  00:29:54  Show Profile  Reply with Quote
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

India
52317 Posts

Posted - 02/27/2013 :  00:31:44  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

India
2210 Posts

Posted - 02/28/2013 :  09:14:53  Show Profile  Reply with Quote
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

India
52317 Posts

Posted - 02/28/2013 :  09:55:26  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

3648 Posts

Posted - 03/01/2013 :  07:38:37  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

India
2210 Posts

Posted - 03/01/2013 :  08:29:12  Show Profile  Reply with Quote
quote:
Originally posted by James K

Thank you James

--
Chandu
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.09 seconds. Powered By: Snitz Forums 2000