If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > Error: Could not insert new row - duplicate value in a UNIQUE INDEX column

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-24-06, 17:02
@Dowland @Dowland is offline
Registered User
 
Join Date: Mar 2006
Posts: 1
Error: Could not insert new row - duplicate value in a UNIQUE INDEX column

I'm trying to set up a script which loads an informix table that I will
use in my Access report.

I will be loading new customers into it based on transaction date. But
users can have more than one day's transaction, if I load a bunch of
people yesterday and a few of them also have a transaction today, I get
that error, and the processing stops even if most of today's customers
are not there already. How do I get Informix to just ignore the Index
Violation and then continue? What I want is one row per customer
during the current fiscal year which will be deleted at the start of
the new fiscal year and updated to 0 at the start of a new month.

The table that I'm loading customers into has fields for sales this
year, sales this month and yesterday's sales. I want to load new
customers, but if a customer is already in the table, I want it to add
yesterday to the fiscal year total and the fiscal month total.
Otherwise, getting the totals takes forever.

If I try not exists or not in, it is pretty slow.
Reply With Quote
  #2 (permalink)  
Old 03-27-06, 07:07
gurey gurey is offline
Registered User
 
Join Date: Aug 2003
Location: Argentina
Posts: 780
Hi,
I think that you should revise the logic of the process and if finds an existing client, that rewrite the row instead of inserting it.
Or, change the process, and use temporary table before, then filter this rows.

Gustavo.
Reply With Quote
  #3 (permalink)  
Old 03-27-06, 09:21
mjldba mjldba is offline
Registered User
 
Join Date: Dec 2003
Location: North America
Posts: 139
You could also review the schema of the index and do one of these two actions:
(1) add an additional column(s) to the index to preserve uniqueness of the index (preferred)

(2) make the index non-unique so duplicates (according to the index schema) will be allowed
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On