Regarding MERGE Command

  • Hi,

    I am Jr. DBA at my company and recently I come across a lot of code writing by somebody else utilizing MERGE command. I read a big description of this command but I don't fully understand.

    I understand it is new in 2008 version.

    Could somebody please explain it? I will greatly appreciate it. Thank you!

  • Oksana March (5/20/2010)


    Hi,

    I am Jr. DBA at my company and recently I come across a lot of code writing by somebody else utilizing MERGE command. I read a big description of this command but I don't fully understand.

    I understand it is new in 2008 version.

    Could somebody please explain it? I will greatly appreciate it. Thank you!

    In a nutshell...

    Picture this, merge command "merges" the content of table_a into table_b.

    For rows that do not exist in table_b merge implements an insert statement.

    For rows that already exist in table_b merge implements an update statement.

    Note: for "exists" I mean merge keys on table_a and table_b match.

    _____________________________________
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at Amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply