Ask a Question related to Microsoft SQL / MS SQL Server, Design and Development.

  1. #1

    Default Case Sensitive

    I did the following:

    1. create table amit (name varchar(10) not null Primary
    key)
    2. insert into amit values ('a')
    3. select * from amit
    4. insert into amit values ('A')

    When I fired the insert statement as in 4th step, i
    got 'Violation of primary key constraint.'

    Can anyone tell me is SQL Server Case insensitive.
    If it really is case insensitive then I am sure there must
    be some global option for making it case sensitive.

    Actually I am from Oracle background, and haven't spent
    much time in SQL Server 2000. What I know off is Oracle
    being case sensitive.

    Thanking in advance for help extended.

    Regards,
    Amit

    amit Guest

  2. Similar Questions and Discussions

    1. SQL 92 - case sensitive
      Hi, I would like to know if the use of " " in the tables creation in SQL or in the fields definition, is a specification of SQL 92 ? Where...
    2. #23026 [Com]: Make Zend case-sensitive (classes, functions, remove case-insensitive)
      ID: 23026 Comment by: nvivo at mandic dot com dot br Reported By: mfischer@php.net Status: Open Bug Type: ...
    3. Glob() is Case Sensitive
      I have a search script on my site that uses glob(), how can I make it NON-Case Sensitive? Thanks for your help! Krhis
    4. getPos is case sensitive
      Hello, I tought everything is director is case insensitive, but i just found out that the getPos and getOne function isn't. I have a list with...
    5. Is varaible name case sensitive?
      Hi all, I have wrote a ASP page: ********************************************* <%@ LANGUAGE="JSCRIPT" %> <% var pricelist = "a"; ...
  3. #2

    Default Re: Case Sensitive

    In earlier versions than 2000, you determined whether it is case sensitive at install time. In
    SQL2K, you define collation for the system db's at install time. You can specify some other
    collation as default for the db when you create the db. And you can divert from db default
    collation in CREATE TABLE. Run below to see collation for the columns:

    EXEC sp_help tblname

    --
    Tibor Karaszi, SQL Server MVP
    Archive at: [url]http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver[/url]


    "amit" <amit_agarwal20@yahoo.co.in> wrote in message
    news:083001c347a2$6e08a440$a401280a@phx.gbl...
    > I did the following:
    >
    > 1. create table amit (name varchar(10) not null Primary
    > key)
    > 2. insert into amit values ('a')
    > 3. select * from amit
    > 4. insert into amit values ('A')
    >
    > When I fired the insert statement as in 4th step, i
    > got 'Violation of primary key constraint.'
    >
    > Can anyone tell me is SQL Server Case insensitive.
    > If it really is case insensitive then I am sure there must
    > be some global option for making it case sensitive.
    >
    > Actually I am from Oracle background, and haven't spent
    > much time in SQL Server 2000. What I know off is Oracle
    > being case sensitive.
    >
    > Thanking in advance for help extended.
    >
    > Regards,
    > Amit
    >

    Tibor Karaszi Guest

  4. #3

    Default Re: Case Sensitive

    You can set the collation for the database to be case sensitive, or you can
    set this at the column level (but you'll need to drop the primary key
    constraint temporarily in order to do this). Take a look at collation in
    books online...



    "amit" <amit_agarwal20@yahoo.co.in> wrote in message
    news:083001c347a2$6e08a440$a401280a@phx.gbl...
    > I did the following:
    >
    > 1. create table amit (name varchar(10) not null Primary
    > key)
    > 2. insert into amit values ('a')
    > 3. select * from amit
    > 4. insert into amit values ('A')
    >
    > When I fired the insert statement as in 4th step, i
    > got 'Violation of primary key constraint.'
    >
    > Can anyone tell me is SQL Server Case insensitive.
    > If it really is case insensitive then I am sure there must
    > be some global option for making it case sensitive.
    >
    > Actually I am from Oracle background, and haven't spent
    > much time in SQL Server 2000. What I know off is Oracle
    > being case sensitive.
    >
    > Thanking in advance for help extended.
    >
    > Regards,
    > Amit
    >

    Aaron Bertrand [MVP] Guest

  5. #4

    Default Re: Case Sensitive

    Here is a repro you can try to see the difference between CS (case
    sensitive) and CI (case insensitive) collations at the column level.
    Typically, I try to avoid making an entre database or server case sensitive,
    since this can break a lot of existing code.



    CREATE TABLE [dbo].[foooo]
    (
    bar CHAR(1)
    COLLATE SQL_Latin1_General_CP1_CI_AS
    NOT NULL PRIMARY KEY
    )
    GO

    INSERT foooo(bar) VALUES('a')
    INSERT foooo(bar) VALUES('A') -- fails

    GO

    DECLARE @constraint_name SYSNAME
    SELECT @constraint_name = so.name
    FROM sysconstraints sc
    INNER JOIN sysobjects so
    ON sc.constid = so.id
    AND so.xtype='PK'
    AND sc.id=OBJECT_ID('foooo')

    EXEC('ALTER TABLE [dbo].[foooo]
    DROP CONSTRAINT '+@constraint_name)

    ALTER TABLE [dbo].[foooo]
    ALTER COLUMN bar CHAR(1)
    COLLATE SQL_Latin1_General_CP1_CS_AS
    NOT NULL
    GO

    ALTER TABLE [dbo].[foooo]
    ADD CONSTRAINT PKfoooo
    PRIMARY KEY(bar)
    GO

    INSERT foooo(bar) VALUES('A') -- succeeds
    GO

    SELECT * FROM foooo

    DROP TABLE foooo
    GO



    --
    Aaron Bertrand, SQL Server MVP
    [url]http://www.aspfaq.com/[/url]

    Please reply in the newsgroups, but if you absolutely
    must reply via e-mail, please take out the TRASH.


    "amit" <amit_agarwal20@yahoo.co.in> wrote in message
    news:083001c347a2$6e08a440$a401280a@phx.gbl...
    > I did the following:
    >
    > 1. create table amit (name varchar(10) not null Primary
    > key)
    > 2. insert into amit values ('a')
    > 3. select * from amit
    > 4. insert into amit values ('A')
    >
    > When I fired the insert statement as in 4th step, i
    > got 'Violation of primary key constraint.'
    >
    > Can anyone tell me is SQL Server Case insensitive.
    > If it really is case insensitive then I am sure there must
    > be some global option for making it case sensitive.
    >
    > Actually I am from Oracle background, and haven't spent
    > much time in SQL Server 2000. What I know off is Oracle
    > being case sensitive.
    >
    > Thanking in advance for help extended.
    >
    > Regards,
    > Amit
    >

    Aaron Bertrand [MVP] Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139