2016-03-04 97 views
1

下面的查詢阿拉伯語全文檢索查詢參數化返回任何結果

declare @Query NVARCHAR(100) = '"م*"' 

select * 
from dbo.Word 
where contains([Text], @Query) 

回報沒有結果!但是,如果沒有參數,它會返回預期的結果。

select * 
from dbo.Word 
where contains([Text], '"م*"') 

我在這裏錯過了什麼?

+2

這有什麼區別,如果你前綴有N的字符串,如'N ' 「م*」''? – trincot

回答

1

如果您使用的Unicodenvarchar)字符串,你必須前綴你的字符串常量與N

使用此:

declare @Query NVARCHAR(100) = N'"م*"' --see the "N" before the string? 

select * 
from dbo.Word 
where contains([Text], @Query)