Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

BEGIN TRANSACTION within TRY - CATCH or vice versa

$
0
0

Which of the following connotes the correct coding block structure?

BEGIN TRANSACTION
BEGIN TRY
    --================================================
    -- Add Your Code Here
    --================================================
END TRY
BEGIN CATCH
 ROLLBACK
END CATCH
COMMIT

or

BEGIN TRY
    BEGIN TRANSACTION
    --================================================
    -- Add Your Code Here
    --================================================
    COMMIT
END TRY
BEGIN CATCH
 ROLLBACK
END CATCH


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>