Tayyeb
Tayyeb

Reputation: 147

Search Urdu text by Passing parameter in sql

    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'.کثیر الانتخاب جواب میں سے صحیح جواب منتخب کیجئے'

Upvotes: 1

Views: 137

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1269443

You need the N before the constant:

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

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

Upvotes: 1

Related Questions