Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 ORDER BY not working with Unicode characters

Author  Topic 

ferrethouse
Constraint Violating Yak Guru

352 Posts

Posted - 2009-10-26 : 17:08:32
This doesn't order as expected...


insert into tempCraig values ('Kurs 1: Zielgruppenorientierte Kommunikation – Marktübersicht')
insert into tempCraig values ('Kurs 3: Web-to-Print');
insert into tempCraig values ('Kurs 4: TransPromo-Kommunikation');
insert into tempCraig values ('Kurs 6: Lösungsbasierter Vertrieb');
insert into tempCraig values ('Kurs 2: Variabler Datendruck (für Einsteiger und Fortgeschrittene)');
insert into tempCraig values ('Kurs 5: Mehrkanalkommunikation');

select * from tempCraig order by coldesc

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2009-10-26 : 17:23:56
how is sorting for you now? how do you want it to sort. what collation do you have on server. can you use the appropriate COLLATE on the coldesc when ordering? maybe the server uses one collation but the actual data is another

<><><><><><><><><><><><><><><><><><><><><><><><><>
If you don't have the passion to help people, you have no passion
Go to Top of Page

ferrethouse
Constraint Violating Yak Guru

352 Posts

Posted - 2009-10-26 : 18:28:44
It turns out the spaces after "Kurs" were sometimes char(32) and other times char(160) <-- nbsp;

This was probably caused by the client pasting in HTML text for some of the items. I did a replace on the order by clause and now it works as expected.
Go to Top of Page
   

- Advertisement -