-----------------------------------
--Creating a comma-separated list--
-----------------------------------
DECLARE @EmployeeList varchar(100)
SELECT @EmployeeList = COALESCE(@EmployeeList + ', ', '')
+ CAST(id AS varchar(15))
FROM temp_td_200704
SELECT @EmployeeList
Wednesday, February 23, 2011
[Tips] Create a comma-separated list in one query using COALESCE
Clever, clever. Wish I could take credit for it.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment