Search Urdu text by Passing parameter in sql

122 views Asked by At
    Declare @Topic nvarchar(2000) ='.کثیر الانتخاب جواب میں سے صحیح جواب منتخب کیجئے'

    SELECT  TextbookTopicId,Title FROM TextbookTopic tt WHERE tt.Title =@Topic

I declared a variable and use in where clause but its not working. but if i use 'N' and remove variable from where clause and use text directly in where clause then it works fine


SELECT  TextbookTopicId,Title FROM TextbookTopic tt WHERE tt.Title =N'.کثیر الانتخاب جواب میں سے صحیح جواب منتخب کیجئے'
1

There are 1 answers

2
Gordon Linoff On

You need the N before the constant:

Declare @Topic nvarchar(2000) = N'.کثیر الانتخاب جواب میں سے صحیح جواب منتخب کیجئے';

Otherwise, the value is a varchar() constant that gets converted to nvarchar().