Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
sharona
Yak Posting Veteran
75 Posts |
Posted - 2011-02-22 : 12:27:39
|
| i receive the following error and im not sure whyViolation of PRIMARY KEY constraint 'NYPSignedLIstPK'. Cannot insert duplicate key in object 'dbo.NYPSignedLIst'.CREATE TABLE [dbo].[NYPSignedLIst]( [IdCode] [varchar](30) NOT NULL, [Lname] [varchar](100) NULL, [Fname] [varchar](100) NULL, [Division] [varchar](100) NULL, [PhyType] [varchar](100) NULL, [Role] [varchar](100) NULL, CONSTRAINT [NYPSignedLIstPK] PRIMARY KEY NONCLUSTERED ( [IdCode] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY]GOSET ANSI_PADDING OFFINSERT INTO dbo.NYPSignedLIstselect idcode,lname,fname,division,PhyType,Rolefrom dbo.Wkly_signed_notes |
|
|
yosiasz
Master Smack Fu Yak Hacker
1635 Posts |
Posted - 2011-02-22 : 12:34:03
|
| sounds like you have duplicate idcode.Do this selectidcode, count(*) as dup_countfrom dbo.Wkly_signed_notesgroup by idcodehaving count(*) > 1you will see see a row(s) with dup_count > 1. You have to deal with those rows.If you don't have the passion to help people, you have no passion |
 |
|
|
|
|
|
|
|