Convert the columns into a comma separated string in T-Sql
Convert the columns into a comma separated string in T-Sql
create FUNCTION toCSV (@id int)
RETURNS varchar(100)
AS
BEGIN
DECLARE @List varchar(100)
SELECT @List = COALESCE(@List + ', ', '') +
CAST(name AS varchar(10))
FROM location
WHERE ID in (163,164,165,166,167,168,169,170)
select @list
END;
go
Comments
Post a Comment