UPDATE_INSERT Error java.sql.SQLException "Cannot insert duplicate key"
I have proxy-->JDBC Scenario by using Update_Insert statement.
Sometimes I got the following error:
Error during JDBC-Message-Processing; Reason: Error processing request in sax parser: Error when executing statement for table/stored proc. 'DISPO_Unit' (structure 'Statement'): com.microsoft.sqlserver.jdbc.SQLServerException: ... cannot insert duplicate key. The double key value is (143801).
I searched and get the following SAP-Note 831162 Q & A 19:
19. Using UPDATE_INSERT with MS SQL Server:java.sql.SQLException Cannot insert duplicate key
- Q: When I construct payload using UPDATE_INSERT, I get Cannot insert duplicate key in object XXX. How do I resolve this?
A: You need to create UNIQUE INDEX for the table with 'IGNORE_DUP_KEY' option.
For instance, if the table name is TEST and its primary key is id, then following statement may be executed using Query analyzer tool.
CREATE UNIQUE INDEX TEST_INDEX ON TEST(id) WITH IGNORE_DUP_KEY
After executing the above command, please re-run the scenario.
Could anyone explain how to create the unique index?
Thanks a lot!
Thanks for the info Christine, seems like you have the basics setup correctly...with Artikel_ID being the primary key.
Perhaps since you can successfully retry these messages, then increase that retry on DB setting to something greater than zero?