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
 General SQL Server Forums
 New to SQL Server Programming
 how split a variable into semi-colon separated?

Author  Topic 

sweet_777
Starting Member

16 Posts

Posted - 2010-10-22 : 03:35:37
Hi all,

i have one variable @a(this variable contains emailid's)
@a value is 1@y.com2@y.com3@y.com

how to split this variable into semi-colon separated:

ex:1@y.com;2@y.com;3@y.com

Regards
Sweety


Thanks & Regards
Sweet_77

Sachin.Nand

2937 Posts

Posted - 2010-10-22 : 04:12:47
[code]
declare @a varchar(20)='1@y.com2@y.com3@y.com'
select replace(@a,'.com','.com;')
[/code]

But are you sure all email id's will have a domain with .com?

PBUH

Go to Top of Page

sweet_777
Starting Member

16 Posts

Posted - 2010-10-22 : 04:19:18
No some mailid ends with .in , some ends with .com

like that

Thanks & Regards
Sweet_77
Go to Top of Page

Sachin.Nand

2937 Posts

Posted - 2010-10-22 : 04:24:14
You need to find all the possible existing domain extenstions & use replace function for each one of them.

PBUH

Go to Top of Page
   

- Advertisement -