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
 Appending email using SQL

Author  Topic 

freephoneid
Yak Posting Veteran

52 Posts

Posted - 2010-05-18 : 18:51:43
Hi,
I need to update all email address in the database to as shwon below:

Lets say, I've email column with below data:

abc@hotmail.com
xyz@yahoo.com
ram@abccorp.com


Then, I need to update the above data as shown below:

abc@1hotmail.com
xyz@1yahoo.com
ram@1abccorp.com

Basically, I need to append 1 after @ sign. Is this possible using SQL query? If so, I'll really appreciate if some one can provide it.

Thanks!

singularity
Posting Yak Master

153 Posts

Posted - 2010-05-18 : 19:26:26
[code]
select left(email, charindex('@', email)) + '1' + substring(email, charindex('@', email)+1, len(email))
from yourtable
[/code]
Go to Top of Page

freephoneid
Yak Posting Veteran

52 Posts

Posted - 2010-05-18 : 19:31:11
Thanks a lot, singularity!!!!!!
Go to Top of Page
   

- Advertisement -