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 2008 Forums
 Transact-SQL (2008)
 Update a String

Author  Topic 

sql_server_dba
Posting Yak Master

167 Posts

Posted - 2012-03-15 : 19:35:43
In one of our table, we have an e-mail field and have many records that have the values as abcdefMSN.COM. So is there a way that we can convert it to abcxyz@MSN.COM? Please let me know if there is any function that we can use to do this.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-03-15 : 19:36:59
use charindex() to find the position to insert and use stuff() to insert the character


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

sql_server_dba
Posting Yak Master

167 Posts

Posted - 2012-03-15 : 19:39:10
Wow...what a quick response.Thanks!!!I never used stuff and Charindex. Can you please give me an example with them.
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-03-15 : 20:15:46
Refer to Books Online. There are examples in there
http://msdn.microsoft.com/en-us/library/ms186323.aspx
http://msdn.microsoft.com/en-us/library/ms188043.aspx


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -