Tables and Columns
UPSERT Query Behavior
UPSERT Settings Enabled
UPSERT By Id
When you select UPSERT by in the UPSERT Settings list and choose the table’s key column, the connector issues a query to determine if any records exist with the matching key value:UPSERT By Non-key Column
When you select UPSERT by in the UPSERT Settings list and choose a non-key column, the connector issues a query to determine if any records exist where that column contains the matching value, targeting the primary key in the SELECT (the following examples illustrate UPSERTing to an Orders table):If the selected UPSERT by column is not specified in the input, the lookup is used with a NULL value, as shown in the following query:
Using a Custom Query
When you select Query to select UPSERT key in the UPSERT Settings list, you can write a custom query to determine the UPSERT key. This allows the lookup to use more complex logic than a single column match. Consider the following query:@OrderID syntax is used to reference a value from the matching input XML. You can also use static values: the quotes around 'Active' denote that this clause uses a static value.
Again, a successful match of the key column is used to form an update request. If there is no match, the record is inserted.
UPSERT Settings Disabled
To disable UPSERT behavior for a column, open the UPSERT Settings dialog (right-click the destination column and select UPSERT Settings), toggle Enable UPSERT settings to OFF, and click Apply. When UPSERT settings are disabled, the connector issues only INSERT queries. Examining the code view of the input mapping shows that theaction attribute of the table is insert:
update, as shown in the following snippet: