The Abyss
Me
Dogwood 2
Dogwood
Das Auto
Classical simple machines
Saw
Weekend project fuel
Smile
04-09-2011
I love tools
When the shadows were long
A good place to be
HuHot
HuHot
Crazy sunshine
Tennis feet
HuHot!
04-07-2011
Working
Servers
04-05-2011
04-05-2011
04-03-2011
04-03-2011
04-01-2011
Batman Feet
Make comma seperated list out of records in SQL Server
This is one I’ve been wanting to figure out for awhile and just never got around to it.
So you have a list like this:
Select email from emaillist
Returns:
email1 @ emailme.com
email2 @ emailme.com
email3 @ emailme.com
email4 @ emailme.com
email5 @ emailme.com
I get a record for each email in the table.
What I want is: email1 @ emailme.com,email2 @ emailme.com,email3 @ emailme.com,email4 @ emailme.com,email5 @ emailme.com,etc.
Here’s SQL I found to do it:
Declare @Description varchar(4000)
select @Description = coalesce(@Description + ‘,’ , ”) + rtrim(email) FROM emaillist
select @Description
You can change the ‘,’ to ‘;’ or any character you want for that matter.