[dbo].[ItemCodeVanlineMappingImportWorksheet]
CREATE PROCEDURE [dbo].[ItemCodeVanlineMappingImportWorksheet]
@inIncludeMappings bit
as
set nocount on
set @inIncludeMappings = isnull( @inIncludeMappings, 0 )
select
concat(
isnull( VanLineGroup.VanlineExternalCode, '' ),
char(9),
isnull( ItemCodeVanLineMapping.VanlineServiceCode, '' ),
char(9),
isnull( ItemCodeVanLineMapping.VanlineCartonCode, '' ),
char(9),
ItemCode.ItemCode,
char(9),
isnull( ItemCodeVanLineMapping.VanlineDescription, '' ),
char(9),
ItemCode.[Description],
char(9),
isnull( ItemCode.GLGroup, '' ),
char(9),
isnull( ServiceCode.ServiceCode, '' ),
char(9),
isnull( ServiceCode.[Description], '' ),
char(9),
isnull( RevGroups.[Description], '' )
)
from ItemCode
left outer join dbo.ServiceCode on ServiceCode.ServiceCodePriKey = ItemCode.ServiceCodePriKey
left outer join dbo.RevGroups on RevGroups.RGPriKey = ItemCode.RGPriKey
left outer join ItemCodeVanLineMapping on @inIncludeMappings = 1 and ItemCodeVanLineMapping.ItemCodeFID = ItemCode.ICPriKey
left outer join VanLineGroup on VanLineGroup.VanLineGroupID = ItemCodeVanLineMapping.VanLineGroupFID
order by ItemCode.ItemCode, VanLineGroup.VanlineExternalCode
GO
GRANT EXECUTE ON [dbo].[ItemCodeVanlineMappingImportWorksheet] TO [MssExec]
GO