Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

UPDATE_INSERT Error java.sql.SQLException "Cannot insert duplicate key"

Hi Experts,

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!

Regards

Christine

Former Member
Former Member replied

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?

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question