SQL Server 2005 case sensitivity

  • Why schemas, object names (tables) and columns are to be written using the right case when we work with AdventureWorks in SQL Server 2005 Management Studio ?

    While it is not case sensitive when we work with some user defined objects.

  • Check database collation. it is the collation that enforces you to use proper case.

    ...and your only reply is slàinte mhath

  • The default installation of AdventureWorks is case sensitive.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Grant Fritchey (3/19/2008)


    The default installation of AdventureWorks is case sensitive.

    Really Grant? Wow! I did not know that. Good to know now though, thanks.

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • Grant Fritchey (3/19/2008)


    The default installation of AdventureWorks is case sensitive.

    Can you provide some insight as to why you think AdventureWorks is case-sensitive? The columns are not case-sensitive because even though the table is defined with the name HumanResources.Employee this query works fine:

    select top 100 * from HumanResources.employee

    I am also showing the default collation for data as SQL_Latin_1_General_CP1_CI_AS (CI stands for case-insensitive) which is the default collation for all new databases created in SQL Server.

    Just for grins I ran this query in AdventureWorks:

    select collation_name, count(*) as [count]

    from sys.[columns]

    where collation_name is not null

    group by collation_name

    order by [count] desc

    There are four collations used in the DB and two of those induce binary compares. The two that are not binary, the default collation SQL_Latin1_General_CP1_CI_AS and Latin1_General_CI_AS_KS_WS, both produce case-insensitive comparisons.

    collation_namecount

    ------------------------------------------

    SQL_Latin1_General_CP1_CI_AS316

    Latin1_General_BIN46

    Latin1_General_CI_AS_KS_WS14

    UNICODE_CODEPOINT5

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

Viewing 5 posts - 1 through 4 (of 4 total)

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