Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Add column values in a string

Author  Topic 

henrikop
Constraint Violating Yak Guru

280 Posts

Posted - 2005-04-04 : 10:43:34
It's the end of the day, and I'm not that sharp anymore.

I have a table with users and e-mail addresses (tblUser)

1 Henri Henri@4xs.nl
2 Cindy Cindy@4xs.nl
3 SQLTeam info@SomeWhere.com


No I like to put all the e-mail addresses in one string so I can use it to e-mail From field. This is one example, but I have use of this functionality more often. Is there some generic script for this?



Henri
~~~~
Anyone who can walk to the welfare office can walk to work.
- Al Capone

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-04-04 : 10:46:43
Declare @eMailList varchar(8000)
SELECT @eMailList = COALESCE(@eMailList + ', ', '') + email
FROM MyTable
select @eMailList

Go with the flow & have fun! Else fight the flow
Go to Top of Page

henrikop
Constraint Violating Yak Guru

280 Posts

Posted - 2005-04-04 : 10:52:20
Thx, this what I was looking for! (and in three minutes do you have a RL? )

I'm happy, never saw the use of COALESCE, but now I do!






Henri
~~~~
Anyone who can walk to the welfare office can walk to work.
- Al Capone
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-04-04 : 10:53:20
i do have RL there's also a little thing called active topics here that helps...

EDIT: see... this one was exactly a minute.

Go with the flow & have fun! Else fight the flow
Go to Top of Page
   

- Advertisement -