UPSERT_CONDITION= Data Set Option

Specifies one or more conditions to add to a WHERE condition for a TPT MultiLoad upsert.

Valid in: PROC APPEND only when appending Teradata tables (when using SAS/ACCESS software).
Categories: Bulk Loading
Data Set Control
Default: none
Requirement: MULTILOAD=YES must be specified.
Data source: Teradata
See: MULTILOAD= data set option, UPSERT= data set option, UPSERT_WHERE= data set option

Syntax

UPSERT_CONDITION=condition(s)-to-append

Syntax Description

condition(s)-to-append

specifies one or more conditions that are appended to UPSERT_WHERE= for upsert processing.

Details

By default, TPT MultiLoad upsert uses only the primary index columns of the target table to generate the WHERE condition for upsert processing.

When you need to add conditions to the generated WHERE condition, specify them using UPSERT_CONDITION=. Add the AND keyword between the generated WHERE condition and the specified UPSERT_CONDITION= data set option.

Example

libname x teradata user=user pw=pw;
/* Create Mybase base table-Column i where i is the primary index */
data x.mybase;
i=1;
j=1;
k=1;
output;
i=1;
j=2;
k=2;
output;
run;

/* Create a transaction table */
data x.transaction;
i=1;
j=99;output;
run;

/*  Running Upsert with UPSERT_CONDITION= "j=2" causes "AND j=2" tp be appended 
to the Upsert Where clause. A snippet of the generated MultiLoad script is included:

.DML Label SASDML DO INSERT FOR MISSING UPDATE ROWS;
UPDATE "mybase"
  SET "j"=:"j","k"="k";
WHERE "i"=:"i" AND j=2;
INSERT "mybase"("i","j","k")  VALUES (:"i",:"j",:"k");
*/

proc append base=x.mybase (MULTILOAD=YES  UPSERT=YES   UPSERT_CONDITION="j=2") 
   data=x.transaction;
run;
Last updated: February 3, 2026