HomeForum
Welcome, Guest

[SQL Server]Violation of PRIMARY KEY constraint
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: [SQL Server]Violation of PRIMARY KEY constraint

[SQL Server]Violation of PRIMARY KEY constraint 1 year, 1 month ago #2361

  • Todd
  • OFFLINE
  • Fresh Boarder
  • Posts: 18
  • Karma: 0
Dear Support,

I am attempting to import data into a SQL database of customer equipment to test your visual importer. I do not know how to correctly import into a table with two fields which comprise the primary key. In the example below, the customer and address_id combine to make the primary key. A Customer may have more than one record if they have more than one location but the combination of customer and address_id is unique. When I import, I get an error -

bcp_done Failed: 23000 [Microsoft][ODBC SQL Server Driver][SQL Server]Violation of PRIMARY KEY constraint 'PK__SVC_ADDRESS__173876EA'. Cannot insert duplicate key in object 'SVC_ADDRESS'. 01000 [Microsoft][ODBC SQL Server Driver][SQL Server]The statement has been terminated.

Can you help me understand how to correct this error. Love your product so far! Thanks.

M.Todd

Re: [SQL Server]Violation of PRIMARY KEY constraint 1 year, 1 month ago #2372

  • admin
  • OFFLINE
  • Moderator
  • Posts: 2191
  • Karma: 12
Perhaps the problem is not with the source data but with the target?

You have duplicates in target database?

Try using "add new update existing records transformation"

John
  • Page:
  • 1
Time to create page: 0.16 seconds

Testimonials

Visual Importer ETL  saved us 25-30 hours per month. Much of that comes from being able to build in error checking into the scripting. I've even been able to script corrections that run on the fly triggered by the error checking on incoming order files.

Gene Kovacs,
Director of Technical Business Operations,
A2B

User Login

You only need to log in or register to use our support forum



Our customers

BP

BBC

HSBC


Databases we work with

Go to top