查询 SQL Server 2008 表以查找包含 Unicode 字符的列中的值 [英] Querying a SQL Server 2008 table to find values in a column containing Unicode characters
问题描述
我正在处理的项目中遇到一个问题:特定 SQL Server 2008 表列中的某些字符串值包含 Unicode 字符.例如,有些字符串将包含 EM DASH(http://www.fileformat.info/info/unicode/char/2014/index.htm).
I've run into a problem in a project I'm working on: some of the string values in a specific SQL Server 2008 table column contain Unicode characters. For example, instead of a dash some strings will instead contain an EM DASH (http://www.fileformat.info/info/unicode/char/2014/index.htm).
当我向第三方服务器发送 HTTP 请求时,包含 Unicode 字符的列值会导致问题.有没有办法查询哪些行包含一个或多个 Unicode 字符,这样我至少可以开始确定需要修复多少行?
The column values that contain Unicode characters are causing problems when I send HTTP requests to a third-party server. Is there a way to query what rows contain one-or-more Unicode characters, so I can at least begin to identify how many rows need to be fixed?
推荐答案
您想查找包含一个或多个 ASCII 字符 32-126 之外的字符的所有字符串.
You want to find all strings that contain one or more characters outside ASCII characters 32-126.
我认为这应该可以完成工作.
I think this should do the job.
SELECT *
FROM your_table
WHERE your_column LIKE N'%[^ -~]%' collate Latin1_General_BIN
这篇关于查询 SQL Server 2008 表以查找包含 Unicode 字符的列中的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!