How to sort a table in other language than english?

Discussion in 'Databases' started by thomassen, May 16, 2009.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Hi

    I do understand that the language of the SQL server is english. But this gives me trouble with sorting rows alphabetical since norwegians we have 3 "special" characters in our alphabet.

    Example:
    Norwegian alphabet: "abcdefghijklmnopqrstuvwxyzøæå". Look at those three last letters. This is the order of sorting in Norway.
    But my sql-db sorting like "A" and "Å" and "Æ" is the same letter. Also that "Ø" and "O" is the same as well. So when somones name is "Åsmund" (sounds like Aasmund). It should be in end of the list. But now its together with Asgeir in the first rows...

    Solutions?
    Is there any way to make the SQL server return list with sorting order in Norwegian??? I do have the SQL 2008 version.

    Regards,
    Thomassen
     
  2. I think this is a SQL collation issue although I could be wrong and hopefully the DASP guys will set me straight if I lead you down the wrong path.

    SQL 2008 collation is specified at installation time which on the DASP servers you have no control over and also at database instance and table level which you can control.

    Norway is scandinavian so I expect the SQL_Scandainavian_Pref_Cp850_CI_AS_KI_WI collation is the one you need.

    To determine the current collation you can run:

    --For database

    select databasepropertyex(db_name(),'collation') as collation_name
    go

    --Tables

    select column_name, collation_name from INFORMATION_SCHEMA.COLUMNS
    where table_name = 'TableName'


    You can change the collation at table level like this:
    ALTER TABLE MyTable ALTER COLUMN CharCol
    varchar(10)COLLATE Latin1_General_CI_AS NOT NULL


    You can change the collation at database level:
    ALTER DATABASE database_name
    {
    | MODIFY NAME = new_database_name
    | COLLATE collation_name
    | <file_and_filegroup_options>
    | <set_database_options>
    }


    More info:
    http://msdn.microsoft.com/en-us/library/ms144250.aspx
    http://msdn.microsoft.com/en-us/library/ms190920.aspx
    http://sqlblogcasts.com/blogs/ssqan...n-of-database-whats-new-in-sql-2008-then.aspx
     
  3. Thanks!

    Thanks for your reply
    I will try this soulution.

    Regards,
    Thomassen
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page