Showing posts with label raiserror in sql. Show all posts
Showing posts with label raiserror in sql. Show all posts

Wednesday, February 3, 2016

SQL (Query with transaction under try and catch)

BEGIN TRY
    BEGIN TRANSACTION

    --Your Set Of Query/Quries Here...
    SELECT 'A QUICK BROWN FOX JUMP OVER THE LAZZY DOG'

    COMMIT TRANSACTION
END TRY

BEGIN CATCH
       RAISERROR('Custom Error Message Here...',16,-1)
    ROLLBACK TRANSACTION
END CATCH