Use COALESCE to create a CSV

This has proved time and again to be a useful method of creating a datafeed.

DECLARE @EmployeeList varchar(100)

SELECT @EmployeeList = COALESCE(@EmployeeList + ', ', '') + 
   CAST(Emp_UniqueID AS varchar(5))
FROM SalesCallsEmployees
WHERE SalCal_UniqueID = 1

SELECT @EmployeeList
Technorati Tags: ,
3. December 2009 12:47 by Danny Gershman | Comments (0) | Permalink

Add comment


(Will show your Gravatar icon)  

  Country flag


Enter Numbers In Image Above: biuquote
  • Comment
  • Preview
Loading



About dannyg

dannyg has been writing software for the last 12+ years and worked with various languages and programs.  He specializes business process automation, versatile solutions and R&D.