問題描述
我有一個表格,其中一列的多行中有一個錯誤符號(' ').
I have a table with an erroneous symbol('?') in a number of rows in one column.
下面的 TSQL 腳本不起作用.
The TSQL script below does not work.
UPDATE S
SET S.Offering_Details = REPLACE(S.Offering_Details, '?', '...')
FROM tblSacrifices S
相關列的數據類型為 nvarchar(230) 并允許空條目.
The column in question has datatype of nvarchar(230) and allows null entries.
數據來自通過 Visual Studio Windows 應用程序從 Excel 和 d 轉換而來的 csv 文件.數據最初是...",但我認為 word/excel 可能將其歸類為一個字符(而不是 3 個單獨的.").當我的應用程序從 CSV 文件讀取原始字符串時,它(無意中)在將數據提交到數據庫之前將..."替換為"".
The data came from a csv file converted from Excel an d via a Visual studio windows app. The data originally was '...' but I think perhaps word/excel classed this as one character (rather than 3 separate '.'). When my application read the original string from CSV file it (unintentionally) replaced the '...' with '?' before submitting the data into the database.
請幫忙
推薦答案
想通了.感謝大家的幫助.
Figured it out. Thanks all for your help.
我不得不轉換為二進制.65500 以上的所有 unicode 字符都需要這樣做,因為正常的 REPLACE() 不起作用.
I had to convert to binary. All unicode characters above 65500 require this as normal REPLACE() doesn't work.
UPDATE S
SET S.Offering_Details = REPLACE(S.Offering_Details, nchar(65533) COLLATE Latin1_General_BIN, '...')
FROM tblSacrifices S
這篇關于SQL Server 2008:替換字符串的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!