As mentioned in the Merge Statement Configuration section, this Merge Statement option helps in updating or inserting rows in target table with rows selected from one or more source tables.

To merge a statement with the MSSQLserver, perform the following actions:

  1. Select Merge Statement option in SQL configuration



  2. In the Merge Query Builder panel,
    1. provide a name for the query in the Query Name text box.
    2. Under the Select source and target tables section, click the Add button under the Select Target Table subsection.



  3. In the Table Selection Dialog panel that pops up, click the Fetch Schemas button and select the table after clicking the Refresh Tables button. Click OK after choosing the table.

    Icon

    The table that is selected will be the target table for the Merge query.



  4. Under the Select source and target tables section, click the Select Query Wizard button under the Select Source Table subsection (see the figure in Step 2).
    Select the source table for the merge query and choose the columns to be merged.



  5. Select or clear the target table column fields based on the preference of building the query.



  6. The Pre-condition section gets auto populated based on the selected target table fields.

    Icon

     Precondition performs a functionality when there is a match for the merge condition.

    Provide a value in the Column Value cell which in this case is the following:



  7. Now expand the Post-condition section and perform the following actions and click OK to save the changes:

    1. Enter the corresponding column value of column name as alias."name".
    2.  Add values in the Insert values using map or Insert values using SELECT Query.

      Icon

      In this example, the Insert values using map option is selected which prompts the values to be inserted when there is no match for merge condition.

      The Merge SQL query appears under the SQL statement.

Adaptavist ThemeBuilder EngineAtlassian Confluence