I have a stored procedure where I pass a parameter that is unicode and looks like following:
מוכר שמן קוקוס בכחל מיני ואריציות
Now the problem here is that when I enter something in my form to search for this value in m table like fllowing:
IF LEN(@SearchValue) > 0
BEGIN
SET @WhereQuery = @WhereQuery +
'(Type=' + CAST(@type AS NVARCHAR(10)) + ' and UserId=' + CAST(@userid AS NVARCHAR(10)) + ') and'
+ '(convert(nvarchar(max),SentWord) like ''%' + @SearchValue + '%'' or '
+ 'convert(nvarchar(max),Comment) like ''%' + @SearchValue + '%'')'
END
Where @SearchValue is defined as nvarchar(200) in SQL server and table columns that hold the specific value are:
SentWord and Comment and both are unicode defined as nvarchar(600).
What am I doing wrong here? Why cant MSSQL search by hebrew characthers ? Can someone help me out?
As @Jeroen stated , possible fix would be to add N after LIKE operator like following:
IF LEN(@SearchValue) > 0
BEGIN
SET @WhereQuery = @WhereQuery +
'(Type=' + CAST(@type AS NVARCHAR(10)) + ' and UserId=' + CAST(@userid AS NVARCHAR(10)) + ') and'
+ '(convert(nvarchar(max),SentWord) like N''%' + @SearchValue + '%'' or '
+ 'convert(nvarchar(max),Comment) like N''%' + @SearchValue + '%'')'
END
But it still doesn't works...