Home > Archive > ASE Database forum > March 2006 > bcp error in duplicate key error









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 bcp error in duplicate key error
jcserrano@ahorro.com

2006-03-28, 3:30 am

Hi,

is there any way to control this kind of errors in a bcp in
?

Thanks in advance.

Server Message: ACSTATS - Msg 2601, Level 14, State 1:
Attempt to insert duplicate key row in object 'DATA1' with
unique index 'PK_DATA1'
Meg

2006-03-28, 11:32 am

remove the unique index. bcp the data in, and then figure
out why the data violates the unique index. either adjust
the unique index so all composite keys make uniqueness,
or... delete the offending data.

this can also be done by bcping into a 'staging' table to
diagnose...

HTH (Hope this helps!)
Meg


> Hi,
>
> is there any way to control this kind of errors in a bcp
> in ?
>
> Thanks in advance.
>
> Server Message: ACSTATS - Msg 2601, Level 14, State 1:
> Attempt to insert duplicate key row in object 'DATA1' with
> unique index 'PK_DATA1'

Rob Verschoor

2006-03-28, 11:32 am

<Meg> wrote in message news:442979e3.7e88.1681692777@sybase.com...[color=darkred]
> remove the unique index. bcp the data in, and then figure
> out why the data violates the unique index. either adjust
> the unique index so all composite keys make uniqueness,
> or... delete the offending data.
>
> this can also be done by bcping into a 'staging' table to
> diagnose...
>
> HTH (Hope this helps!)
> Meg
>
>


Depending on what you want to achive, you can also create a unique index
with 'ignore_dup_key' -- this will discard rows with duplicate keys. But
again, it depends what it is that you want here.

HTH,

Rob
-------------------------------------------------------------
Rob Verschoor

Certified Sybase Professional DBA for ASE 12.5/12.0/11.5/11.0
and Replication Server 12.5 / TeamSybase

Author of Sybase books (order online at www.sypron.nl/shop):
"Tips, Tricks & Recipes for Sybase ASE"
"The Complete Sybase Replication Server Quick Reference Guide"
"The Complete Sybase ASE Quick Reference Guide"

mailto:rob@YOUR.SPAM.sypron.nl.NOT.FOR.ME
http://www.sypron.nl
Sypron B.V., P.O.Box 10695, 2501HR Den Haag, The Netherlands
-------------------------------------------------------------


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