Home All Groups Group Topic Archive Search About
Author
28 Jun 2006 1:17 PM
Baren
Hi! All,

I don't know whether this question fits into this forum or not> I just need
some help in regards to the below question.

I want to insert a unique key constraint on a column in an already existing
table which happens to have duplicate entries so that it doesn't check the
already existing entries but checks the new entry.

Thanks in advance for the help

Regards,
Baren

Author
28 Jun 2006 1:38 PM
Patrice
Can't you get rid of these duplicates once for all ? You may want to
elaborate a bit about your exact scenario.

--
Patrice

"Baren" <Ba***@discussions.microsoft.com> a écrit dans le message de news:
2E5B8DED-F202-48D6-B871-8D08CDBF1***@microsoft.com...
Show quote
> Hi! All,
>
> I don't know whether this question fits into this forum or not> I just
> need
> some help in regards to the below question.
>
> I want to insert a unique key constraint on a column in an already
> existing
> table which happens to have duplicate entries so that it doesn't check the
> already existing entries but checks the new entry.
>
> Thanks in advance for the help
>
> Regards,
> Baren
Author
28 Jun 2006 1:49 PM
Sericinus hunter
Baren wrote:
> Hi! All,
>
> I don't know whether this question fits into this forum or not> I just need
> some help in regards to the below question.
>
> I want to insert a unique key constraint on a column in an already existing
> table which happens to have duplicate entries so that it doesn't check the
> already existing entries but checks the new entry.

    Use WITH NOCHECK option with your ALTER TABLE statement.
Author
28 Jun 2006 2:15 PM
Sericinus hunter
Sericinus hunter wrote:
> Baren wrote:
>> Hi! All,
>>
>> I don't know whether this question fits into this forum or not> I just
>> need some help in regards to the below question.
>>
>> I want to insert a unique key constraint on a column in an already
>> existing table which happens to have duplicate entries so that it
>> doesn't check the already existing entries but checks the new entry.
>
>    Use WITH NOCHECK option with your ALTER TABLE statement.

    Sorry, I misread. This will not work with unique constraint.
Author
28 Jun 2006 1:56 PM
Sanjib Biswas
If the column already contains duplicate records there's no way you can
create an unique key constraint on that column. You should first find all
the duplicate records having same column value for which you want to create
unique constraint. Then modify those column values to an unique value. Only
after that you can add the unique constraint.

Regards
Sanjib

Show quote
"Baren" <Ba***@discussions.microsoft.com> wrote in message
news:2E5B8DED-F202-48D6-B871-8D08CDBF194A@microsoft.com...
> Hi! All,
>
> I don't know whether this question fits into this forum or not> I just
> need
> some help in regards to the below question.
>
> I want to insert a unique key constraint on a column in an already
> existing
> table which happens to have duplicate entries so that it doesn't check the
> already existing entries but checks the new entry.
>
> Thanks in advance for the help
>
> Regards,
> Baren

AddThis Social Bookmark Button