Re: Case Sensitivity in Unique Indexes and Constraints
From: tony mays (tonymays_at_discussions.microsoft.com)
Date: 12/26/04
- Next message: Hugo Kornelis: "Re: Tree questions about DATETIME"
- Previous message: John Bell: "Re: 6.5 to 2000 upgrade - Logon failure..."
- In reply to: Sylvain Lafontaine: "Re: Case Sensitivity in Unique Indexes and Constraints"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 26 Dec 2004 11:25:02 -0800
thank you both for your assistance.
"Sylvain Lafontaine" wrote:
> The database will consider it if it's the default setting for the database
> but on installation of SQL-Server, the default values are set for Case
> Insensitivity and Accent Sensitivity.
>
> S. L.
>
> "tony mays" <tonymays@discussions.microsoft.com> wrote in message
> news:8A3CFEA1-FF06-4E45-A837-D8DC2D5D752F@microsoft.com...
> > Thank you Dan for responding so fast. I never thought to use the collate
> > clause on the column thinking that the database/table had already
> > considered
> > it. The example in your response works great and I am greatful to you for
> > it
> > ... what a Christmas present. Again, thank you so much.
> >
> > Tony Mays
> >
> > "Dan Guzman" wrote:
> >
> >> The behavior depends on the collation of the columns involved. You can
> >> use
> >> a case-sensitive collation if you need case sensitivity. For example:
> >>
> >> create table test
> >> (
> >> field1 varchar(20) collate Latin1_General_CS_AS not null
> >> )
> >> insert into test (field1) values ('ABC')
> >> insert into test (field1) values ('abc')
> >> alter table test add primary key (field1)
> >>
> >> --
> >> Happy Holidays
> >>
> >> Dan Guzman
> >> SQL Server MVP
> >>
> >> "tony mays" <tonymays@discussions.microsoft.com> wrote in message
> >> news:63C7B2D0-5E2D-4671-AF14-7AED37F6C82C@microsoft.com...
> >> > it appears that case sensitivity is not considered when creating a
> >> > unique
> >> > index. Consider the following example:
> >> >
> >> > create table test
> >> > (
> >> > field1 varchar(20) not null
> >> > )
> >> > insert into test (field1) values ('ABC')
> >> > insert into test (field1) values ('abc')
> >> > commit
> >> >
> >> > alter table test add primary key (field1)
> >> >
> >> > the alter table statement fails due to duplicate data.
> >> >
> >> > Any ideas as to how to get around this?
> >> >
> >> >
> >> > --
> >> > tony mays
> >>
> >>
> >>
>
>
>
- Next message: Hugo Kornelis: "Re: Tree questions about DATETIME"
- Previous message: John Bell: "Re: 6.5 to 2000 upgrade - Logon failure..."
- In reply to: Sylvain Lafontaine: "Re: Case Sensitivity in Unique Indexes and Constraints"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|