Reputation: 613
I have a column of name, varchar(200). In this column data can be filled in hebrew and english.
I have code that does queries on this DB, I want to have the option to sort the results - first hebrew and then english - and the other way as well.
How can it be done? if at all...
Upvotes: 1
Views: 1000
Reputation: 238116
This would sort any name with a Hebrew character on top, and in Hebrew order. The other names would be sorted in English order:
select *
from YourTable
order by
case
when name like '%[... all hebrew letters here ...]%' then name
end collate Hebrew_CI_AS
, name collate Latin1_General_CI_AS
In a collation, CI
means Case Insensitive. AS
means Accent Sensitive.
Upvotes: 3