我正在尝试使用 unicode 字符执行查询.我能够通过在查询前添加 N(例如:..... WHERE column=N'exact_stringâ')来执行正常的等式查询.但是当我尝试使用 LIKE 时,这似乎不起作用.关于如何完成这项工作的任何想法?
I am trying to execute a query with unicode characters. I was able to execute the normal equality query by prepending N to the query (Eg: ..... WHERE column=N'exact_stringâ'). But that doesn't seem to work when I try to use LIKE. Any ideas on how to make this work?
示例查询:SELECT * FROM t_sample WHERE t_column LIKE N'%â%'
另外,我如何知道 SQL Server 使用哪种编码来存储 nvarchar 或 nchar 数据类型以及它使用哪种编码在 SQL 编辑器中显示查询?
Also how can I know which encoding does the SQL Server use to store the nvarchar or nchar data type and what encoding it uses to show the query in SQL Editor?
我的错.这实际上有效.我尝试在错误的窗口中执行查询.但这样做的好处是我了解了 SQL Server 中的排序规则设置.
My bad. This actually works. I have tried executing the query in a wrong window. But the upside of this is that I learned about Collation settings in SQL Server.
推荐答案确保您的表上的排序规则支持 unicode.
Make sure the collation on your table supports unicode.
更多推荐
如何使用带有 unicode 字符串的“LIKE"语句?
发布评论