Groups | Blog | Home
all groups > sql server dts > july 2003 >

sql server dts : Duplicate Primary Keys?


JFB
7/21/2003 4:18:49 PM
Hi Jon,
You can skip the duplicate row or import the row creating a new key in the
transformation task properties using lookups.
Example
http://www.sqldts.com/default.aspx?6,107,277,7,1
JFB

[quoted text, click to view]

Jon Glazer
7/21/2003 5:05:17 PM
I am trying to copy data from one SQL server to another (hopefully on a
schedule soon). Anyhow when I run it, I get the following error:

Error at Destination for Row number 246271. Errors encountered so far in
this task: 1.
The statement has been terminated.
Violation of PRIMARY KEY constraint 'PK_CART'. Cannot insert duplicate key
in object 'Cart'.

Ok, I understand what the error means. Essentially there is a duplicate
(autoincremented) primary key, which, in itself, seems like it should not be
possible. But lets just say, it is (well yea it is). How do I correct
this? The issue here is 2 fold..

1. If I do have a primary key violation in a table, how do I fix it? I get
no indication of what row the violation is in. In addition, how could this
happen anyhow?

2. Why do I get this error from DTS? I thought DTS would copy virtually the
entire table, structure and all. If the source DB is in one state (errors
or not) why would the DTS be unable to duplicate it? And finally, how do I
avoid having DTS dump when it hits an error like this? I'd rather just omit
the problematic erros rather than have a totally bad copy of the database.

THANKS FOR THE HELP!! This is very appreciated!

Jon

Allan Mitchell
7/22/2003 7:48:46 AM
You can do a series of comparisons using TSQL looking for comparisons on the
PKs

Also you may like to investigate

Multiphase Data Pump (Field Notes)
http://www.sqldts.com/default.aspx?6,107,282,7,1

--

----------------------------
Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org



[quoted text, click to view]

AddThis Social Bookmark Button