Hola Edwin, intenta lo siguiente:
DECLARE @cod_alt as varchar(1) DECLARE @item as nvarchar(10) DECLARE @cliente as nvarchar(100) SET @ITEM = (SELECT $[INV1.Itemcode]) SET @cliente = (Select $[OINV.U_Facnom]) sET @cod_alt = (Select Qrygroup1 From OITM Where ItemCode=@item) IF @cod_alt = 'Y' BEGIN SELECT CASE WHEN @cliente = 'Unisuper, S.A.' THEN (Select U_cod_unisuper From [dbo].[@cod_alt] where code=@item) WHEN @cliente = 'Operadora de Tiendas, S.A.' THEN (Select U_cod_WALMART From [dbo].[@cod_alt] where code=@item) ELSE '' END END
Si tu campo esta en el dato maestro de Articulo basta con:
SELECT T0.TUCAMPO FROM OITM T0 WHERE T0.[ItemCode] = $[$38.1.0]
Saludos.