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 2005 Forums
 Transact-SQL (2005)
 Delimiters

Author  Topic 

dass05555
Yak Posting Veteran

55 Posts

Posted - 2008-06-16 : 03:04:06
Dear gurus,

my problem is below,pls give me solution

if i give the values like

@A='test1@test.com;test2@test.com;test3@test.com;test4@test.com;'


i want to get like this

mail_id
--------
test1@test.com
test2@test.com
test3@test.com
test4@test.com


thanks in advance,



cool...,

ayamas
Aged Yak Warrior

552 Posts

Posted - 2008-06-16 : 03:19:36
declare @mail as varchar(max)
set @mail='test1@test.com;test2@test.com;test3@test.com;test4@test.com'
declare @x xml
set @x='<i>' + replace(@mail,';','</i><i>') + '</i>'
select @x

select x.i.value('.','varchar(50)') from @x.nodes('//i')x(i)
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-06-16 : 03:20:08
See fnParseList here
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=76033



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -