2014-09-04 19 views
0

我在使用正則表達式中的OR運算符更新多個無法運行的電子郵件的多個集合時遇到了問題。我試圖更新來自:我如何在sql的正則表達式中使用OR運算符

[email protected] 
[email protected] 
[email protected] 
[email protected] 
[email protected] 

result should look like this: 

[email protected] 
[email protected] 
[email protected] 
[email protected] 
[email protected] 


I've tried that update procedure for using OR operator like this and it didn't work at all: 

update dbo.Membership 
set Email = left(Email, charindex('@', Email, 0)) + 'dony.com' 
OR Email= left(Email, charindex('@', Email, 0)) + 'bony.com'; 
+0

您只需要更新不包含「bony.com」代替「dony」地址爲@ *。com? – Beth 2014-09-04 15:50:00

回答

0

是你想要這個東西?:

update dbo.Membership 
set Email = left(Email, charindex('@', Email, 0)) + 'dony.com' 
WHERE Email NOT LIKE '%@bony.com'