Table Email:
Values:
josh@yahoo.com
carmine32@hotmail.com
zehmaneh@yahoo.com
I want to replace the string before
You don't even need to use substring or replace, you can use this:
SELECT 'test' + RIGHT(email, charindex('@', REVERSE(email)))
FROM YourTable
You can test it out with this:
DECLARE @email nvarchar(50)
SET @email = 'carmine32@hotmail.com'
PRINT 'test' + RIGHT(@email, charindex('@', REVERSE(@email)))