Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

insert Native SQL

Former Member
0 Likes
538

Hi everybody, I am having a problem when i try to do an insert in a ms sql external database. I am caching the errors, but it doesnt show error. Its like that the operation was executed well, but when i read the table, the records inserted are not there. Wich could be the problem?

Regards

1 ACCEPTED SOLUTION
Read only

former_member194669
Active Contributor
0 Likes
476

Hi,

Have you given commit ?

Like the following


 EXEC SQL.
    SET CONNECTION :con_name
  ENDEXEC.

  IF SY-SUBRC <> 0.
    EXEC SQL.
      CONNECT TO :con_name
    ENDEXEC.

    IF SY-SUBRC <> 0.
*     error handling  " <<<<< Error Handling 
    ENDIF.
  ENDIF.

  EXEC SQL.
*     ... "<<< your code to do something
  ENDEXEC.

* Commit the changes on 'con_name'
  EXEC SQL.
    COMMIT.          "<<<<<<< Commit work
  ENDEXEC.
  EXEC SQL.
    SET CONNECTION DEFAULT
  ENDEXEC.

aRs

2 REPLIES 2
Read only

former_member194669
Active Contributor
0 Likes
477

Hi,

Have you given commit ?

Like the following


 EXEC SQL.
    SET CONNECTION :con_name
  ENDEXEC.

  IF SY-SUBRC <> 0.
    EXEC SQL.
      CONNECT TO :con_name
    ENDEXEC.

    IF SY-SUBRC <> 0.
*     error handling  " <<<<< Error Handling 
    ENDIF.
  ENDIF.

  EXEC SQL.
*     ... "<<< your code to do something
  ENDEXEC.

* Commit the changes on 'con_name'
  EXEC SQL.
    COMMIT.          "<<<<<<< Commit work
  ENDEXEC.
  EXEC SQL.
    SET CONNECTION DEFAULT
  ENDEXEC.

aRs

Read only

Former Member
0 Likes
476

The commit was thw problem. Thanks.