开发者

SQL Server 2005 transaction

开发者 https://www.devze.com 2023-01-24 12:16 出处:网络
This may be very basic question. If we open a sql transaction with \"Begin Transaction\", is commit transaction or rollback is mandatory...?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消