Wednesday, March 12, 2008

How To get the comma delimited list:

DECLARE @EmailList nvarchar(100)
SELECT @EmailList = COALESCE(@EmailList,'') + COALESCE(Email,'') + ',' FROM addressbook
WHERE Email IS NOT NULL
SET @EmailList = SUBSTRING(@EmailList,0,LEN(RTRIM(@EmailList)))


PRINT @EmailList

No comments: