CREATE PROCEDURE [dbo].[BillingEvent] @EventTypeID int, @UserID int, @ProjectID int AS declare @id int begin tran insert into [Billing] with (rowlock) ([EventTypeID], [UserID], [ProjectID]) values (@EventTypeID, @UserID, @ProjectID) set @id = SCOPE_IDENTITY() commit tran select @id -- ---------------------------------------------------- CREATE PROCEDURE [dbo].[BillingEventRefresh] @EventID int AS begin tran update [Billing] with (rowlock) set [EventRefreshDT] = GETDATE() where [ID] = @EventID and [PeriodDT2] is null commit tran -- ---------------------------------------------------- CREATE PROCEDURE [dbo].[BillingEventClose] @EventID int, @RespondentID int, @RespondentCallID int, @IsSuccess bit AS begin tran update [Billing] with (rowlock) set [PeriodDT2] = GETDATE(), [PeriodDuration] = DATEDIFF(second, [PeriodDT1], GETDATE()), [iv_RespondentID] = @RespondentID, [iv_RespondentCallID] = @RespondentCallID, [iv_IsSuccess] = @IsSuccess where [ID] = @EventID commit tran