[dbo].[UpdateCurrentDriverName]
CREATE PROCEDURE [dbo].[UpdateCurrentDriverName]
@inOrderID int,
@inChangedBySysUserID int = null,
@inUpdateSource varchar(128) = null,
@inDriverSysUserID int = null,
@inDriverName varchar(64) = null
as
set nocount on
declare @theOrderAuditInfoFID bigint
if( isnull( @inChangedBySysUserID, 0 ) <= 0 )
begin
set @inChangedBySysUserID = ( select SysUserId from SysUser where SysUser.FIRSTNAME = 'External' and SysUser.LASTNAME = 'Application' )
end
if( isnull( @inDriverName, '' ) = '' and @inDriverSysUserID > 0 )
begin
set @inDriverName = (
select dbo.FormatFirstNameLastName( SysUser.FirstName, SysUser.LastName )
from SysUser
where SysUser.SysUserID = @inDriverSysUserID
)
end
if( isnull( @inUpdateSource, '' ) = '' )
begin
set @inUpdateSource = 'Unspecified Van Line Download'
end
exec PrepOrderForAuditLog
@inSysUserID = @inChangedBySysUserID,
@inUpdateSource = @inUpdateSource,
@outOrderAuditInfoFID = @theOrderAuditInfoFID output
update OrdersExtended set
CurrentDriver = @inDriverName,
OrderAuditInfoFID = @theOrderAuditInfoFID
from OrdersExtended
where OrdersExtended.OrderFID = @inOrderID
GO
GRANT EXECUTE ON [dbo].[UpdateCurrentDriverName] TO [MssExec]
GO