Skip to Content
author's profile photo Former Member
Former Member

SQL

Hi,

What is the difference between Update and Modify in SQL?

Thanks in advance...

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    Posted on Dec 04, 2007 at 11:54 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 04, 2007 at 11:56 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 04, 2007 at 11:57 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 04, 2007 at 12:00 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.