This may be very basic question. If we open a sql transaction with "Begin Transaction", is commit transaction or rollback is mandatory...?
I have a s开发者_开发问答cenario where i need to exit the SP when a row exists in if statement fails. This if statement is currently inside the transaction scope..
Thanks in advance!
Regards Bala
If we open a sql transaction with "Begin Transaction", is commit transaction or rollback is mandatory...?
It's not mandatory, the transaction will stay open until an error or the connection is closed. But you don't want to do this, you may be blocking other users for a very long time.
You should COMMIT TRANSACTION or ROLLBACK TRANSACTION at the earliest opportunity.
加载中,请稍侯......
精彩评论