i have this table
Cream ---------- CHOCALATE GREEN TEST
want out put in select query like this
cream
CHOCALATE,GREEN,TEST
i have this table
Cream ---------- CHOCALATE GREEN TEST
want out put in select query like this
CHOCALATE,GREEN,TEST
With sysobjects this worked:
DECLARE @List varchar(2000)
SELECT @List = COALESCE(@List + ',', '') + Cast(name As varchar(50))
FROM sys.sysobjects
SELECT @List As 'List'
The best way to do this, is to create an aggregate user defined function and register it on the database.
Try here for an example.
http://msdn.microsoft.com/en-us/library/ms165055.aspx
Your query would look like "SELECT dbo.Concatenate(Field) FROM Cream"
You will be returned what you expect "a,b,c,d..." ect.