Search

Sunday, January 31, 2010

Char Index Replace LastWord with New Word in sql

select email, SUBSTRING(email, CHARINDEX('@',email)+1,30) from details where len(email) > 0

--Replace all email domain name with new domain name

--ex:-@abc.com replace by @def.com

UPDATE details

SET Email=REPLACE(Email,SUBSTRING(email, CHARINDEX('@',email)+1,30),'def.com') where len(email) > 0

No comments:

Blog Archive

Contributors