ALTER
Procedure
[
dbo
]
.
[
prClearLeaseShedule
]
-- Set value of Lease of all equipment associated with expired Lease Schedule to 0
-- Set total amount of Lease Schedule to 0.
@intLeaseScheduleId int
As
begin transaction
-- Set value of Lease of all equipment associated with expired Lease Schedule to 0
update Inventory
set Lease = 0
where LeaseScheduleId = @intLeaseScheduleId
if @@Error <> 0 goto PROBLEM
-- Set total amount of Lease Schedule to 0
update LeaseSchedule
Set PeriodicTotalAmount = 0
where ScheduleId = @intLeaseScheduleId
if @@Error <> 0 goto PROBLEM
commit transaction
return 0
PROBLEM:
print ' Unable to eliminate lease amounts from the database! '
rollback transaction
return 1
-- Set value of Lease of all equipment associated with expired Lease Schedule to 0
-- Set total amount of Lease Schedule to 0.
@intLeaseScheduleId int
As
begin transaction
-- Set value of Lease of all equipment associated with expired Lease Schedule to 0
update Inventory
set Lease = 0
where LeaseScheduleId = @intLeaseScheduleId
if @@Error <> 0 goto PROBLEM
-- Set total amount of Lease Schedule to 0
update LeaseSchedule
Set PeriodicTotalAmount = 0
where ScheduleId = @intLeaseScheduleId
if @@Error <> 0 goto PROBLEM
commit transaction
return 0
PROBLEM:
print ' Unable to eliminate lease amounts from the database! '
rollback transaction
return 1