Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

how to use multiple transactions in sql server

BEGIN TRANSACTION;
BEGIN TRY
    DELETE from A
    COMMIT TRANSACTION;
END TRY
BEGIN CATCH
ROLLBACK TRANSACTION;
END CATCH


BEGIN TRANSACTION;
BEGIN TRY
    DELETE     from B
    COMMIT TRANSACTION;
END TRY
BEGIN CATCH
    ROLLBACK TRANSACTION;
END CATCH
 
PREVIOUS NEXT
Tagged: #multiple #transactions #sql #server
ADD COMMENT
Topic
Name
4+9 =