DBCONSTRAINT= Data Set Option

Provides table-level definitions to specify when a table is created.
Valid in: DATA and PROC steps (when accessing DBMS data using SAS/ACCESS software)
Default: None
Requirement: You must specify constraints within the CREATE TABLE statement parentheses.
Data source: Teradata
See: DBCREATE_TABLE_OPTS= data set option

Syntax

DBCONSTRAINT='DBMS-SQL-clauses'

Syntax Description

DBMS-SQL-clauses
indicates one or more clauses that are specific to Teradata that must be specified when creating a table but that must appear inside the CREATE TABLE parentheses.

Details

Use this option to add table-level definitions in the CREATE TABLE statement. DBCREATE_TABLE_OPTS= is similar to this option except that it lets you add DBMS-specific text outside (to the right) of the parentheses.

Example: Specify Primary Key Columns for a Table

In this example, DBCONSTRAINT= specifies a table-level constraint that columns x and y are primary key columns.
libname x teradata user=testuser pw=testpw;

/* 
 * Submits this SQL with table-level constraints.
 *
 * CREATE MULTISET TABLE "test" 
 * ("x" FLOAT NOT NULL ,
 *  "y" FLOAT NOT NULL ,
 *   CONSTRAINT test PRIMARY KEY(X,Y)
 * );
 */
data x.test(DBCONSTRAINT='CONSTRAINT test PRIMARY KEY(X,Y)' DBNULL=(_ALL_=NO));
x=1;y=1;
run;