Application Development 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: 

SQL

Former Member
0 Kudos

Hi,

What is the difference between Update and Modify in SQL?

Thanks in advance...

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Update statement only updates the existing record but Modify statement checks if the record exists in the DB. If so, it updates the record else it creates a new record.

Reward if clear...

Thank you.

4 REPLIES 4

Former Member
0 Kudos

Hi,

Update statement only updates the existing record but Modify statement checks if the record exists in the DB. If so, it updates the record else it creates a new record.

Reward if clear...

Thank you.

Former Member
0 Kudos

Hi

. Update will only update.

2. Its better to use MODIFY statement.

Based upon the primary key found/not found

in database table,

it will automatially Update / INSERT

the record.

3. We can do like this.

Loop at ITAB.

Modify DatabaseTable From Itab.

ENDLOOP.

MODIFY TO INSERT LINES INTO DATABSE TABLE REGARDLESS OF WHETHER THE PRIMARY KEY OF THIS LINE IS ALREADY EXISTS, USE MODIFY STATEMENTS.

IF THE DATABASE TABLE CONTAINS NO LINE WITH SAME PRIMARY KEY AS THE LINE TO BE INSERTED, MODIFY words LIKE INSERT IS USED.

IF THE DATABASE TABLE ALREADY CONTAINS LINE WITH SAME PRIMARY KEY AS THE LINE TO BE INSERTED,MODIFY words LIKE UPDATE ie THE LINE IS CHANGED

FOR MORE DOCUMENTATION GO THROUGH

http://www.sappoint.com/faq/faqsql.pdf

former_member194613
Active Contributor
0 Kudos

the modify is a combination of update and insert. First it tries to update, if there is no record then it does an insert instead of update.

Performancewise, the modify is not arrayprocessing enabled. If you are sure, that an update is sufficient, then do not use modify.

Siegfried

Former Member
0 Kudos

Hi

<b>Update</b>

It will update all the records with same name in the particular field of the table. other wise it creates a new record

<b>Modify</b>

If record is available it modifies otherwise it wont modify.

Regards

Pavan