Syntax - ODBC Driver for Teradata

ODBC Driver for Teradata User Guide

Product
ODBC Driver for Teradata
Release Number
16.10
Published
May 2017
Language
English (United States)
Last Update
2018-07-11
dita:mapPath
smj1488824663219.ditamap
dita:ditavalPath
Audience_PDF_product_legacy_odbc_include.ditaval
dita:id
B035-2526
lifecycle
previous
Product Category
Teradata Tools and Utilities

The syntax for Atomic UPSERT is straightforward and self-explanatory, consisting of an UPDATE statement and an INSERT statement separated by an ELSE keyword, as follows:

UPDATE <update-operands> ELSE INSERT <insert-operands>

The <update-operands> and <insert-operands> are operands for regular UPDATE and INSERT SQL statements, respectively.

UPDATE Sales SET ItemCount = ItemCount + 1 WHERE (ItemNbr = 20 AND SaleDate = '05/30/2000') ELSE INSERT INTO Sales (20, '05/30/2000', 1);