Hi TX Support,
I wanna know how to implementing scalar function with COALESCE in TX ?
Here I attach the function, could you please tell me how to do that?
USE QAD_DATA]
GO
/****** Object: UserDefinedFunction dbo]..GetAliasesByWo1] Script Date: 03/20/2018 16:15:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER FUNCTION dbo]..GetAliasesByWo1]
(
@item nvarchar(max),
@length float,
@catego nvarchar(max),
@opt nvarchar(max)
)
RETURNS varchar(max)
AS
BEGIN
declare @output varchar(max)
select @output = COALESCE(@output + ', ', '') + wo_lot + '=' + convert(nvarchar, wo_qty_ord)
FROM wo_mstr_data
where wo_part = @item and
wo__dec01 = @length and
wo__chr01 = @catego and
RIGHT(wo_rmks,1) = @opt and
wo_status = 'R' and
SUBSTRING(wo_routing,1,6) = 'REWORK'
return @output
END