2017-04-13 64 views
1

我有問題從數據庫中只有一列刪除變音符號。是否有可能只從一列中刪除變音符號?從SQL Server中只有一列刪除變音符號

我想:

select 'áéíóú' collate SQL_Latin1_General_Cp1251_CS_AS 

,但它是在整個表。

我需要:

表1

Column1 Column2 Column n 
------------------------ 
šbook sbook 
čbook cbook 
ěbook ebook 
ábook abook 
...  ... 
+0

可能是這樣helps.https://www.sqlservercentral.com/Forums/572109/How-to-replace-accented-characters- with-non-accented-ones – McNets

+0

爲什麼不能在SELECT語句中使用COLLATE:'SELECT Column1,Column1 COLLATE SQL_Latin1_General_Cp1251_CS_AS AS Column2 FROM Table1'? – Serge

+0

如何將它寫成UPDATE? – Luka

回答

2

使用convert()varchar()collate

update t 
set Column2 = convert(varchar(32),Column1 collate SQL_Latin1_General_Cp1251_CS_AS); 

select Column1, Column2 
from t; 

rextester演示:http://rextester.com/FSW95264

回報:

+---------+---------+ 
| Column1 | Column2 | 
+---------+---------+ 
| šbook | sbook | 
| čbook | cbook | 
| ěbook | ebook | 
| ábook | abook | 
+---------+---------+ 
0

UPDATE表1 SET [列2] = @ [列2] WHERE [列2] COLLATE FROM [DBO] QL_Latin1_General_Cp1251_CS_AS [表1]