Skip to Content
avatar image
Former Member

UPDATE_INSERT Statement doesn't work

Hi gurus,

i try to update a table on my MSSQL DB. I use "UPDATE_INSERT" action to insert or update the records. But i got following error message in RWB monitoring;

Message processing
failed. Cause:
com.sap.engine.interfaces.messaging.api.exception.MessagingException: Error
processing request in sax parser: Error when executing statement for
table/stored proc. 'BR_SALES' (structure 'STATEMENT'): com.microsoft.sqlserver.jdbc.SQLServerException:
Violation of UNIQUE KEY constraint 'UK_BR_SALES'. Cannot insert duplicate
key in object 'dbo.BR_SALES'. The duplicate key value is (0002000020, 2012-06-07).

Can anyone assist me?

Regards,

PM

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Jun 15, 2012 at 10:10 AM

    Obviously you tried to insert a duplicate value on a field with unique constraint. You need to find out why.

    CSY

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 14, 2012 at 09:52 AM

    Hi,

    easy way:

    1. use - logSQLStatement and set it to true in your JDBC channel to see the SQL statement

    which you can use on the DB to see why it's not working

    2. you can ask your DB admin to turn on the trace on DB to see why it's failing over there

    3. maybe you're trying to insert the same record twice in your data set ?can you check that too?

    Regards,

    Michal Krawczyk

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 14, 2012 at 10:06 AM

    Hi Peter,

    Check SAP Note 831162, the question 19. Using UPDATE_INSERT with MS SQL Server:java.sql.SQLException Can not insert duplicate key.

    Regards.

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 14, 2012 at 04:14 PM

    Insert_Update statement will not behave for sql server as that of other database like oracle. The solution to the problem is already specified by Inaki's SAP note. Take help from DB team. Basically you need to create unique index for the table BR_Sales with Ignore_Dub_key option.

    Add comment
    10|10000 characters needed characters exceeded