Home > Archive > MS SQL Server DTS > October 2005 > DUP Primary Key









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author DUP Primary Key
Luis Mena

2005-10-27, 7:57 am

I work in DTS Package and this DTS insert fileds from TXT file into any
table.
I need control with ON ERROR RESUME NEXT the error "Violation of PRIMARY KEY
constraint. Cannot insert duplicate key in object <table">. Because i can't.
Somebody help me plissss!

Thank's

LML



Allan Mitchell

2005-10-27, 7:57 am

Hello Luis,

A PK Violation will abort the batch.

I had a small amount of success here.

Multiphase Data Pump (Field Notes)
(http://www.sqldts.com/default.aspx?282)

A much cleaner solution would be to import your file to a staging table and
then use TSQL to compare key values. You can then only insert rows with
key values not already in the destination.


Allan




> I work in DTS Package and this DTS insert fileds from TXT file into
> any
> table.
> I need control with ON ERROR RESUME NEXT the error "Violation of
> PRIMARY KEY
> constraint. Cannot insert duplicate key in object <table">. Because i
> can't.
> Somebody help me plissss!
> Thank's
>
> LML
>



Luis Mena

2005-10-27, 7:57 am

Thanks Allan, you give the solution.
Regards.

LML


"Allan Mitchell" <allan@no-spam.sqldts.com> wrote in message
news:f0343b0354c68c7
a241021836b0@msnews.microsoft.com...
> Hello Luis,
>
> A PK Violation will abort the batch.
>
> I had a small amount of success here.
>
> Multiphase Data Pump (Field Notes)
> (http://www.sqldts.com/default.aspx?282)
>
> A much cleaner solution would be to import your file to a staging table

and
> then use TSQL to compare key values. You can then only insert rows with
> key values not already in the destination.
>
>
> Allan
>
>
>
>
>
>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com