The sum of all SQL Server matter that exist,
and the space in which all SQL Server events
occur or could occur.
Welcome to SQL Server Universe.com Sign in | Join | Help
in
Home SS SLUG Forums Articles Photos Downloads

Case Sensitive Qusetion

Last post 06-06-2008, 11:00 by lucki. 2 replies.
Sort Posts: Previous
  • Case Sensitive Qusetion

     06-06-2008, 10:37

    • Joined on 10-17-2007
    • Posts 5
    • Points 0
    • Top 25 Contributor

     Hi,

     Is Sql Server Case Sensitive? Can i insert 'Auto' and 'auto' the same word to a primary key field in Sql Server 2005?

     Please can u help me with this.Its urgent

     

     Thanks

     

  • Re: Case Sensitive Qusetion

     06-06-2008, 10:55

    • Joined on 11-22-2006
    • Colombo, Sri Lanka
    • Posts 226
    • Points 0
    • Top 10 Contributor
      Male

    Hi,

    SQL Server uses collations which specify rules on how character strings are compared and sorted etc. These collation settings can be set at the server level, database level or column level. The default collation settings for your server instance is specified during installation. This is usually Latin1_General_CI_AI which is not case sensitive. This will be used across all your databases and table columns unless specified. Therefore you cannot perform the action which you require (i.e. to insert 'auto' and 'Auto' into the primary key field).

    In order to be able to perform this you could create a column which is case sensitive in your table by using the Latin1_General_CS_AI as shown below.

    CREATE TABLE MyTable
    (
       [Code] varchar(10) COLLATE Latin1_General_CS_AS PRIMARY KEY
    )
    GO

    You could also set a specific collation setting at the database level as well. Refer Books Online for more details on collation settings.

    Hope this little explanation was useful...

    Regards


    Gogula G. Aryalingam (MVP - SQL Server)

    DB Antics

  • Re: Case Sensitive Qusetion

     06-06-2008, 11:00

    • Joined on 10-17-2007
    • Posts 5
    • Points 0
    • Top 25 Contributor

    Thanks for the information it was very helpful.

     

     

View as RSS news feed in XML

(Best viewed with a resolution of more than 1024 * 768)

Powered by Community Server, by Telligent Systems