views:

32

answers:

1

I have a SQL Server 2005 database in which I have some tables contain Arabic text. The datatype for those fields is NVARCHAR(n).

The Arabic text inside the table is appearing properly, and when selecting, they appear properly.

Th problem is that searching for Arabic text results in 0 rows.

select * from table_name
where name='arabic_text'

This retrieves no rows, where there is a name with this value.

Can you please guide me on how to write the query?

+3  A: 

Try adding N before the text e.g.

select * from table_name
where name=N'arabic_text'
Conrad Frix
thank you it works goooooooooooooooooood
mohammed sameeh
The need to prefix a test comparison with "N" outside the single quotes is because of the data type (NVARCHAR), when searching by non-ASCII characters (which is why you wouldn't notice an issue searching for English text. The N stands for "Nationalized", but means UTF (8 I assume).
OMG Ponies
there is an other problem with sqldatareader when the condtion in sql command is arabic like this select *from users where nam=N 'arabic text' this does not retrieve any data although there is a user name with this arabic value so what is solution
mohammed sameeh
@Mohammed you're probably not going to get an answer to your .net question when its a comment inside a sql question. You're better off asking another question. Of course doing a search first is a good idea
Conrad Frix
i searched for this question on google but no answer , so i will ask another question ,thank for advice ^_^
mohammed sameeh