Tables and Columns
UPSERT Query Behavior
UPSERT Slider Set to ON
UPSERT By Id
If the key column is present in the input XML, a query is issued to the database to determine if any records exist with the matching key:UPSERT By Non-key Column
A query is issued to the database to determine if any records exist where the selected UPSERT By column contains the matching value, by selecting the primary key of the 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
You can also write a custom query to select the UPSERT key. This option allows for the lookup to be performed using more complex logic than just 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 Slider Set to OFF
When the slider is set to OFF, the connector simply inserts all queries into the database. Examining the code view of the input mapping shows that theaction attribute of the table is insert:
update, as shown in the following snippet: