开发者

SQL Server 2005 transaction

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜