Friday, July 22, 2011

Comma separated values in SQL Server

For comma seperated value

;WITH ctm
SELECT id,id AS idlist ,VName [Name],0 AS [Status] FROM testTableData
WHERE fk_id = 0
SELECT, AS idlist,tt.Vname [Name],1 AS [Status] FROM testTableData tt
INNER JOIN ctm AS ct ON = tt.FK_id
AND ct.[Status] = 0

SELECT * FROM ctm ORDER BY id,idlist,[Name]

No comments:

Post a Comment

Locations of visitors to this page