Some one have an idea how to improve performance using this function that runs over 2680 records.
alter FUNCTION dbo.ConcatRows
(
@input int
)
RETURNS varchar(8000) AS
BEGIN
DECLARE @Output varchar(4000)
SELECT @Output = COALESCE(@Output, '') + Cast(' ' as varchar(10))+ Cast(Name as varchar(30))
FROM TABLE01
WHERE [Number] = @input
RETURN @Output
END
select Number,Name,Manager, dbo.ConcatRows(Number)
from TABLE01 group by Number,Name,Manager
Thanks
alter FUNCTION dbo.ConcatRows
(
@input int
)
RETURNS varchar(8000) AS
BEGIN
DECLARE @Output varchar(4000)
SELECT @Output = COALESCE(@Output, '') + Cast(' ' as varchar(10))+ Cast(Name as varchar(30))
FROM TABLE01
WHERE [Number] = @input
RETURN @Output
END
select Number,Name,Manager, dbo.ConcatRows(Number)
from TABLE01 group by Number,Name,Manager
Thanks