Home All Groups Group Topic Archive Search About

Server: Msg 2627, ...Violation of PRIMARY KEY constraint

Author
2 Jul 2005 10:52 AM
erncelen
When I try to update a table I receive the following message

Server: Msg 2627, Level 14, State 1, Line 1
Violation of PRIMARY KEY constraint 'PK_BP_STEP_LINKS'. Cannot insert
duplicate key in object 'BP_STEP_LINKS'.
The statement has been terminated.


I have set NOCHECK CONSTRAINT ALL before executing the statement

But for other table not....

Who can suggest me how to solve the problem

Author
2 Jul 2005 1:54 PM
Dan Guzman
The Books Online states that NOCHECK applies only to FOREIGN KEY and CHECK
constraints.  When updating primary key columns or inserting new rows, the
new values must not already exist in the table


--
Hope this helps.

Dan Guzman
SQL Server MVP

Show quote
"erncelen" <ernce***@discussions.microsoft.com> wrote in message
news:E6FB8543-D33B-4554-A1D9-9EEBDC59BB85@microsoft.com...
> When I try to update a table I receive the following message
>
> Server: Msg 2627, Level 14, State 1, Line 1
> Violation of PRIMARY KEY constraint 'PK_BP_STEP_LINKS'. Cannot insert
> duplicate key in object 'BP_STEP_LINKS'.
> The statement has been terminated.
>
>
> I have set NOCHECK CONSTRAINT ALL before executing the statement
>
> But for other table not....
>
> Who can suggest me how to solve the problem
>
Author
2 Jul 2005 2:05 PM
Andrew J. Kelly
Exactly how did you set this?  Why would you want to have a table with
duplicate PK's on purpose?  Either it is a PK or it is not.

--
Andrew J. Kelly  SQL MVP


Show quote
"erncelen" <ernce***@discussions.microsoft.com> wrote in message
news:E6FB8543-D33B-4554-A1D9-9EEBDC59BB85@microsoft.com...
> When I try to update a table I receive the following message
>
> Server: Msg 2627, Level 14, State 1, Line 1
> Violation of PRIMARY KEY constraint 'PK_BP_STEP_LINKS'. Cannot insert
> duplicate key in object 'BP_STEP_LINKS'.
> The statement has been terminated.
>
>
> I have set NOCHECK CONSTRAINT ALL before executing the statement
>
> But for other table not....
>
> Who can suggest me how to solve the problem
>

AddThis Social Bookmark Button