顯示事務

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
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章