Table Email
:
Values:
josh@yahoo.com
carmine32@hotmail.com
zehmaneh@yahoo.com
I want to replace the string before @
with test
.
Result:
test@yahoo.com
test@hotmail.com
test@yahoo.com
How do I use substringing and replace based on a character in the string?
You can use
SUBSTRING
andCHARINDEX
:Fiddle: http://sqlfiddle.com/#!3/0face/6/0
You could
Result:
You don't even need to use
substring
orreplace
, you can use this:You can test it out with this: