Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. SQL Server
  3. Question
SQL Server

What are the best practices for committing a transaction in SQL Server where TRY CATCH is used?

Asked by Ankit Chauhan Apr 22, 2021 5 views 1 answer
Share

About this question

In a SQL Server code block, what is the best place to place the commit transaction? Inside the try-catch block or outside it?. For example, please check and confirm whether Option A or Option B is the correct approach? Or are both are subjective? Option A 

Option B

In Option B, there is possibly some error, when its doing a commit outside the TRY-CATCH block?

Your answer

1 Answer

More SQL Server discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest SQL Server Blogs

Guides, tips and career advice on SQL Server from JanBask experts.