SQL Server 2k: Know if collation sensitive or not

  • Hello everybody,

    Currently I’m trying to find a way to determine if the collations are sensitive or not (case, accent,…) I know that we have the information with the stored procedure : “sp_helpsort” but I must have in return some param like case = sensitive, accent = insensitive. Maybe you will say just analyze the string, I think that it’s better to go search directly the info into the system.

    What I have found now, it’s :

    SELECT SERVERPROPERTY ('COLLATION')

    It’s give me the collation used (very helpful)

    SELECT COLLATIONPROPERTY('SQL_AltDiction_CP850_CI_AI', 'CodePage')

    It’s give me the code page used when I put into the first param the result of the first select statement.

    SELECT COLLATIONPROPERTY('SQL_AltDiction_CP850_CI_AI', 'LCID')

    It’s give me the LCID used into my DB

    Into the syscharsets system table I’ve some info

    In SQL Server 7 in the sysconfigures system table we can have the right param to know if it’s sensitive or not. In fact after this statement you apply a mask to know if it’s sensitive or not. BUT IT DOESN’T WORK in SQL Server 2000.

    select @compflags = value from master.dbo.syscurconfigs where config = 1125

    Before writing this document, I’ve already read a lot of things from the Books online. In fact I think the answer is inside the function : “::fn_helpcollations()”

    I’m sure that I’m really close of the right solution. If you can help me.

    If you want more details to understand what I need, no problem, just ask it.

    Jerome.

  • This is the reason you DO NOT go into the system tables. They change from version to version.

    Better to use the sp_helpsort and parse the string. It will work on all versions.

    Steve Jones

    sjones@sqlservercentral.com

    http://qa.sqlservercentral.com/columnists/sjones

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply