[dbo].[GetCommStmtHeaderInformation]
CREATE PROCEDURE [dbo].[GetCommStmtHeaderInformation]
@userIdForBestTimeZone varchar(32)
AS
begin
set nocount on
declare @outBestTimeZone varchar(32);
exec GetBestUserTimeZoneName
@inSysUserId = @userIdForBestTimeZone,
@inGetServerTimeZoneIfNeeded = 1,
@outBestTimeZone = @outBestTimeZone output
select
CommStmtHeader.MSID,
CommStmtHeader.VendorClassID,
CommStmtHeader.VendorClass,
CommStmtHeader.DateCreated,
CommStmtHeader.ToDate,
CommStmtHeader.Final,
CommStmtHeader.FinalizedOn,
FinalizedOnConvertedToLocal = dbo.ConvertUtcToFirstBestTimeZone( CommStmtHeader.FinalizedOn, @outBestTimeZone ),
CommStmtHeader.FinalizedBy,
CommStmtHeader.CreatedBy,
CreatedByName = dbo.FormatFirstNameLastName(CreatedBy.FIRSTNAME, CreatedBy.LASTNAME),
FinalizedByName = dbo.FormatFirstNameLastName(FinalizedBy.FIRSTNAME, FinalizedBy.LASTNAME)
from CommStmtHeader
left outer join Sysuser as CreatedBy on CreatedBy.SysUserID = CommStmtHeader.CreatedBy
left outer join Sysuser as FinalizedBy on CommStmtHeader.FinalizedBy = FinalizedBy.SysUserID
end
GO
GRANT EXECUTE ON [dbo].[GetCommStmtHeaderInformation] TO [MssExec]
GO