How Can I Ignore Accsents and diacritical marks in WHERE statement?
i use sql statment for searching and i wont to search in text filds where some accent and diacritical marks have been enterd.
like: i want to search for 'e' or 'o' ... letters in this text: "ü??"
if i used: "Select * from table where fild like 'e' " the result will be 0 items.
Also, same proplem in Arabic accents for eg: if i want to search for '???' in this text '?????' , using select where statement. what can i do?
Here is a small example. You may need to read more about collation to completely solve this problem, but this should point you in the right direction. Notice that in the first example, no collation is specified so you get an empty result. In the second example, you specify an Accent Insensitive collation so the data is returned.
Declare @.Temp nVarChar(20)
Set @.Temp = N'ü??'
Select @.Temp As [No Collation Specified]
Where @.Temp Like '%e%'
Select @.Temp As [Collation Specified]
Where @.Temp collate SQL_Latin1_General_CP1_CI_AI Like '%e%'
Thank you..
This statement works properly with French and German,
but it does'nt works with ARABIC or FARSI.
There is no option for Arabic accent insensetive in SQL Collations.
What Can I do now?
I have tried [BRACKETS] after "LIKE" to make the accents
optional, it works but when there is no accent it does'nt.
eg.:"WHERE myfld LIKE '%?[????]???%'". the result was as follows:
?????
?????
but ???? without accents doesn't appear.
Thanks..
No comments:
Post a Comment