2012-09-11 109 views

回答

5

你甚至都不需要使用substringreplace,您可以使用此:

SELECT 'test' + RIGHT(email, charindex('@', REVERSE(email))) 
FROM YourTable 

你可以用这个测试出来:

DECLARE @email nvarchar(50) 
SET @email = '[email protected]' 
PRINT 'test' + RIGHT(@email, charindex('@', REVERSE(@email))) 
+0

不错!谢谢! :) – Testifier

+1

@Testifier您是否尝试过所有解决方案? –

+0

不是全部,只是这一个。 – Testifier

1

你可以

select 'test' + substring(fld, charindex('@', fld), len(fld)) 
+0

+1有比选择的更好的答案 –

相关问题