DECLARE @intErrorCode INT
BEGIN TRAN T1
DELETE FROM PM_PARTNER
WHERE CU_ID = '1'
SELECT @intErrorCode = ERROR
IF (@intErrorCode <> 0) GOTO PROBLEM
INSERT INTO pm_partner
(cu_id, CU_CUSTOM_INITIALS)
VALUES(newid(), 'KYO')
SELECT @intErrorCode =
ERROR
IF (@intErrorCode <> 0) GOTO PROBLEM
COMMIT TRAN T1
PROBLEM:
IF (@intErrorCode <> 0) BEGIN
ROLLBACK TRAN T1
END