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 check it as follows:
DECLARE @email nvarchar(50) SET @email = ' carmine32@hotmail.com ' PRINT 'test' + RIGHT(@email, charindex('@', REVERSE(@email)))
source share