Wednesday, August 13, 2008

SQL Query to fetch in csv format

Query to fetch in csv format

DECLARE @theList varchar(100)
SELECT
@theList = COALESCE(@theList + ', ', '') + RTRIM(ACCOMPLISHMENT)
FROM PS_ACCOMPLISHMENTS
WHERE EMPLID = '3820001'
SELECT @theList