From: Michael on
See

http://blogs.msdn.com/b/michkap/archive/2010/07/13/10037608.aspx

for the answer here, in particular the NEW Latvian collation added to SQL Server 2008.

Michael



Sylvain Lafontaine wrote:

Well, like you said (I don't know Latvian), if this kind of sorting is what in
18-Aug-09

Well, like you said (I do not know Latvian), if this kind of sorting is what
in use today in dictionaries, then it is normal to see "ab" to appears before
"ac" and not after it. Only when the official dictionary alphabet make an
explicit mention that the letter with a diacritic marc must appear at the
end that you will see what your are looking for. For example the spanish
letter "?" that will be always displayed after "n".

I am afraid that you cannot get a different order for your special contexts
without having to cooking up your own sorting order recipe.

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Email: sylvain2009 sylvainlafontaine com (fill the blanks, no spam please)
Independent consultant and remote programming for Access and SQL-Server
(French)


Hello,

Here is the strange thing: I cannot see how to order text in Latvian
language alhabetically, respecting the order of the special characters
(ie, a c e g ..).

Test:
Field txt is set up with collation Latvian / Disctionary Sort / Accent-
sensitive
Query: SELECT * FROM Text ORDER BY txt
Results are ordered without distinguishing between "a" and "a". More
precisely, "ab" would go before "ac" because "b" is before "c", but
judging the difference between "a" and "a" as insignifficant for
sorting purposes.

Quering with forced collation does not give any different results:
SELECT * FROM Text ORDER BY txt COLLATE Latvian_CI_AS

This kind of sorting is normally used in dictionaries, etc, but still,
there are contexts where "aaaaa" should go after "azzzzzz".

Please, tell me if there is a way how to force the query engine
respect the "a" and "a" as different characters (binary sort would not
do, as the chrarcode of "a" is bigger than "z"), before I go into
something like joining the charcode of the first character to other
table where the character order is described, and ordering by this
artificial character index.

Thanks!

Passiday

Previous Posts In This Thread:

On Tuesday, August 18, 2009 7:36 PM
Sylvain Lafontaine wrote:

Well, like you said (I don't know Latvian), if this kind of sorting is what in
Well, like you said (I do not know Latvian), if this kind of sorting is what
in use today in dictionaries, then it is normal to see "ab" to appears before
"ac" and not after it. Only when the official dictionary alphabet make an
explicit mention that the letter with a diacritic marc must appear at the
end that you will see what your are looking for. For example the spanish
letter "?" that will be always displayed after "n".

I am afraid that you cannot get a different order for your special contexts
without having to cooking up your own sorting order recipe.

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Email: sylvain2009 sylvainlafontaine com (fill the blanks, no spam please)
Independent consultant and remote programming for Access and SQL-Server
(French)


Hello,

Here is the strange thing: I cannot see how to order text in Latvian
language alhabetically, respecting the order of the special characters
(ie, a c e g ..).

Test:
Field txt is set up with collation Latvian / Disctionary Sort / Accent-
sensitive
Query: SELECT * FROM Text ORDER BY txt
Results are ordered without distinguishing between "a" and "a". More
precisely, "ab" would go before "ac" because "b" is before "c", but
judging the difference between "a" and "a" as insignifficant for
sorting purposes.

Quering with forced collation does not give any different results:
SELECT * FROM Text ORDER BY txt COLLATE Latvian_CI_AS

This kind of sorting is normally used in dictionaries, etc, but still,
there are contexts where "aaaaa" should go after "azzzzzz".

Please, tell me if there is a way how to force the query engine
respect the "a" and "a" as different characters (binary sort would not
do, as the chrarcode of "a" is bigger than "z"), before I go into
something like joining the charcode of the first character to other
table where the character order is described, and ordering by this
artificial character index.

Thanks!

Passiday

On Wednesday, August 19, 2009 10:04 PM
Passiday wrote:

Sorting Latvian text alphabetically
Hello,

Here is the strange thing: I cannot see how to order text in Latvian
language alhabetically, respecting the order of the special characters
(ie, =C4=81 =C4=8D =C4=93 =C4=A3 ..).

Test:
Field txt is set up with collation Latvian / Disctionary Sort / Accent-
sensitive
Query: SELECT * FROM Text ORDER BY txt
Results are ordered without distinguishing between "a" and "=C4=81". More
precisely, "=C4=81b" would go before "ac" because "b" is before "c", but
judging the difference between "a" and "a" as insignifficant for
sorting purposes.

Quering with forced collation does not give any different results:
SELECT * FROM Text ORDER BY txt COLLATE Latvian_CI_AS

This kind of sorting is normally used in dictionaries, etc, but still,
there are contexts where "=C4=81aaaa" should go after "azzzzzz".

Please, tell me if there is a way how to force the query engine
respect the "a" and "=C4=81" as different characters (binary sort would not
do, as the chrarcode of "=C4=81" is bigger than "z"), before I go into
something like joining the charcode of the first character to other
table where the character order is described, and ordering by this
artificial character index.

Thanks!

Passiday

On Wednesday, August 19, 2009 10:05 PM
Eric Isaacs wrote:

Try forcing the collation to another Latvian collation and see whatyou get...
Try forcing the collation to another Latvian collation and see what
you get...

157
lvidic.257
Latvian dictionary order, case-sensitive
SQL_Latvian_Cp1257_CS_AS_KI_WI

158
lvinc.257
Latvian dictionary order, case-insensitive
SQL_Latvian_Cp1257_CI_AS_KI_WI


SQL Server 2008:
http://msdn.microsoft.com/en-us/library/ms144250.aspx


SQL Server 2005:
http://msdn.microsoft.com/en-us/library/ms144250(SQL.90).aspx


-Eric Isaacs

On Wednesday, August 19, 2009 10:05 PM
Erland Sommarskog wrote:

Re: Sorting Latvian text alphabetically
Passiday (passiday(a)gmail.com) writes:

I do not know Latvian beyond a simple "Sveiks", and on top of all my
newsreader is not capable of UTF-8. But I guess the other character is
a with macron.

How does it look like when you sort in, say, Excel? SQL Server uses the
same collations as in Windows, so the order should be the same.

If I understand you correctly, there are two ways to sort Latvian,
which is not unique: the same is true for German, but there are not
Latvian_Dictonary and Latvian_other collations what I have seen.

If you are on SQL 2008, you could try the new Latvian_100 collations,
and see if this has been addressed. But if co-sorting a and a-macron
is the regular dictionary sorting, I would not hold my breath.

And, no, there is no way to set up a user-defined collation.


--
Erland Sommarskog, SQL Server MVP, esquel(a)sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

On Wednesday, August 19, 2009 10:05 PM
Passiday wrote:

Hello, EricThanks, I tried those, although I have no idea what Latvian text
Hello, Eric


Thanks, I tried those, although I have no idea what Latvian text has
to do with kanatype sensitivity so that there ishould exist such
collations in the list. And this does not bring any difference too...

So, I go on with my custom sorting index. Thanks everybody for your
comments.

Passiday


Submitted via EggHeadCafe - Software Developer Portal of Choice
Composite UI Pattern And Enterprise Settings
http://www.eggheadcafe.com/tutorials/aspnet/14dd2b7f-9da4-4a45-bc93-ce5fdba5c5ee/composite-ui-pattern-and-enterprise-settings.aspx