Board index » delphi » SQL Error 13059 (Duplicate Value)

SQL Error 13059 (Duplicate Value)

Hi

How can I isolate instances of "General SQL Error 13059"
to just those caused by trying to insert a record which would
create a duplicate value in a key or index?

I want to be able to ignore these errors and carry on.

Does any part of edbengineerror such as Category or Sub Code
hold this information perhaps?

Using Delphi 5 pro, Access 97, BDE 5.11.

Thanks for any assistance.

MD

 

Re:SQL Error 13059 (Duplicate Value)


:-/  How about just checking the message?

But anyhow ... you really want to try, if you can, to filter out and
not-make the requests that would result in a duplicate value, if the
odds are in any way favorable that the value being inserted _will turn
out to be a dupe.  Exceptions need to be, well, just that ...
exceptions.

Another strategy to consider is to put the values you want to insert
into a table, then fire a query that will insert rows from one to the
other, allowing the dupes to "bounce off" at that time.  This causes all
of the "bouncing" that's going to happen, to happen all at once and to
happen entirely on the server.

Whether that strategy makes sense, for you in your case, depends
entirely upon the outcome that you expect to have in -your- app with
-your- data.  "Just a thought."

Ahh... wine calls... good night!  ;-)

Quote
>Martyn Davies wrote:

> Hi

> How can I isolate instances of "General SQL Error 13059"
> to just those caused by trying to insert a record which would
> create a duplicate value in a key or index?

> I want to be able to ignore these errors and carry on.

> Does any part of edbengineerror such as Category or Sub Code
> hold this information perhaps?

> Using Delphi 5 pro, Access 97, BDE 5.11.

> Thanks for any assistance.

> MD

--
----------------------------------------------------------------
Sundial Services :: Scottsdale, AZ (USA) :: (480) 946-8259
mailto:i...@sundialservices.com  (PGP public key available.)

- Show quoted text -

Quote
> Fast(!), automatic table-repair with two clicks of the mouse!
> ChimneySweep(R):  Release 4.0 is here!!
> http://www.sundialservices.com/products/chimneysweep

Other Threads