ALTER Proc Delete_ScheduledMaintenance
(
@MaintenanceID int,
@ClientId bigint
)
AS
DECLARE
@intErrorCode INT
Declare @RESULT
int
BEGIN TRANSACTION
UPDATE MaintainenceHistory set MaintainenceHistory.IsDeleted =1 where MaintainenceHistory.MaintainenceId=@MaintenanceID
SELECT @intErrorCode = @@ERROR
IF (@intErrorCode
<> 0) GOTO ERROR
UPDATE MaintainenceEntry set MaintainenceEntry.IsDeleted = 1 where MaintainenceEntry.MaintenanceId=@MaintenanceID
SELECT @intErrorCode = @@ERROR
IF (@intErrorCode <> 0) GOTO ERROR
COMMIT TRANSACTION
SELECT @RESULT = 1
ERROR:
IF (@intErrorCode
<> 0)
BEGIN
SELECT
@RESULT = -1
ROLLBACK TRAN
END
SELECT @RESULT
0 comments:
Post a Comment