package queries

const GetProductNewSecondColors = `
SELECT
    LTRIM(RTRIM(@ProductCode)) AS ProductCode,
    LTRIM(RTRIM(ISNULL(@ColorCode, ''))) AS ColorCode,
    LTRIM(RTRIM(d2.ItemDim2Code)) AS ItemDim2Code,
    ISNULL(NULLIF(LTRIM(RTRIM(cd.ColorDescription)), ''), LTRIM(RTRIM(d2.ItemDim2Code))) AS ColorDescription
FROM dbo.cdItemDim2 AS d2
LEFT JOIN dbo.cdColorDesc AS cd
    ON cd.ColorCode = d2.ItemDim2Code
    AND cd.LangCode = 'TR'
WHERE ISNULL(d2.IsBlocked, 0) = 0
  AND LEN(LTRIM(RTRIM(ISNULL(d2.ItemDim2Code, '')))) = 3
ORDER BY LTRIM(RTRIM(d2.ItemDim2Code));
`
