如何使用带有 unicode 字符串的“LIKE"语句?

编程入门 行业动态 更新时间:2024-10-26 20:27:45
本文介绍了如何使用带有 unicode 字符串的“LIKE"语句?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试使用 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"语句?

本文发布于:2023-10-28 05:32:23,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1535674.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字符串   如何使用   语句   unicode   quot

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!