Azure SQL 未返回结果

问题描述

我有一个像下面这样的简单查询

select * from regulation where description = 'Regulation (EU) 2016'

select * from regulation where description like '%regulation (EU)%'

select * from regulation where description like '%regulation (E%'

以上查询均未返回结果。

但是,当我这样做时

    select * from regulation where description like '%regulation%'

结果返回为,Regulation (EU) 2016

我检查了是否有任何空格或任何其他字符,但没有任何内容。表中的描述类型为(nvarchar(max),null)

很奇怪,我很困惑,从未见过这样的问题。有没有人遇到过类似的问题?或者,我做错了什么?或者,它是否与 Azure sql 设置或缓存相关,我需要请 DBA 重新编制索引??

请帮忙。谢谢。

解决方法

我认为我们可以在查询中使用 N'xxx' 强制转换为 Unicode 字符,如下所示:

select * from regulation where description = N'Regulation (EU) 2016'

select * from regulation where description like N'%Regulation (EU)%'

select * from regulation where description like N'%Regulation (E%'