BEGIN TRAN
BEGIN TRY
UPDATE TBL_DEPT
SET NAME = 'acc'
WHERE DEPT_ID = 1
SELECT * FROM TBL_DEPT WHERE DEPT_ID = 1
UPDATE TBL_EMP
SET D_ID = 1
WHERE EMP_ID = 1
SELECT * FROM TBL_DEPT WHERE DEPT_ID = 1
COMMIT TRAN
END TRY
BEGIN CATCH
ROLLBACK TRAN
SELECT * FROM TBL_DEPT WHERE DEPT_ID = 1
END CATCH
No comments:
Post a Comment