Hi Developers,
i need to remove special characters and numerics in my sql query.
my code is
DECLARE @USErId AS VARCHAR(100)='[email protected]'
SELECT DISTINCT
CASE WHEN ISNULL(@USERID,'') LIKE '%t-mobile.com%' THEN REPLACE(REPLACE(REPLACE(@USERID,SUBSTRING (@USERID,CHARINDEX( '@', @USERID ) + 1, LEN(@USERID)),''),'@',''),'.','') ELSE SUBSTRING(@USErId, 1, CHARINDEX('.', @USERID)-1) +REPLACE(SUBSTRING(SUBSTRING(@USERID, CHARINDEX('.', @USERID) + 1, 1000), 1, CHARINDEX('@', SUBSTRING(@USERID, CHARINDEX('.', @USERID) + 1, 1000))-1), REVERSE(LEFT(reverse(SUBSTRING(SUBSTRING(@USErId, CHARINDEX('.', @USERID) + 1, 1000), 1, CHARINDEX('@', SUBSTRING(@USERID, CHARINDEX('.', @USERID) + 1, 1000))-1)), PATINDEX('%[0-9][^0-9]%', reverse(SUBSTRING(SUBSTRING(@USERID, CHARINDEX('.', @USERID) + 1, 1000), 1, CHARINDEX('@', SUBSTRING(@USERID, CHARINDEX('.', @USERID) + 1, 1000))-1)) ))),'') END AS 'Original Owners', CASE WHEN ISNULL(@USERID,'') LIKE '%t-mobile.com%' THEN ISNULL(@USERID,'') ELSE '' END AS 'OriginalOwnerEmail' My expected output = paulraj
if anyone know how to do this kindly suggest me to done this task
Regards & Thanks
Paul.S