Uneven Technology
Friday, December 4, 2015
MSSQL - How to Use BEGIN TRAN & COMMIT TRAN
-- roll back automatically when failure occurs
SET
XACT_ABORT
ON
...
BEGIN
TRAN
BEGIN
TRY
...
COMMIT
TRAN
END
TRY
BEGIN
CATCH
ROLLBACK
RAISERROR
(
'SQL script failed'
,
16
,
1
)
END
CATCH
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment