2012-09-11 107 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有比選擇的更好的答案 –

相關問題