Adds columns to, drops columns from, and changes column attributes in an existing table. Adds, modifies, and drops integrity constraints from an existing table.
Restrictions: | You cannot use any type of view in an ALTER TABLE statement. |
You cannot use ALTER TABLE on a table that is accessed by an engine that does not support UPDATE processing. | |
You must use at least one ADD, DROP, or MODIFY clause in the ALTER TABLE statement. | |
See: | Updating Data in a PROC SQL Table |
adds the integrity constraint that is specified in constraint-specification and assigns constraint-name to it.
adds the column or columns that are specified in each column-definition.
names a column in table-name.
is one of the following integrity constraints:
specifies that all rows in table-name satisfy the WHERE-clause.
specifies that the values of each column must be unique. This constraint is identical to UNIQUE.
specifies a foreign key, that is, a set of columns whose values are linked to the values of the primary key variable in another table (the table-name that is specified for REFERENCES). The referential-actions are performed when the values of a primary key column that is referenced by the foreign key are updated or deleted.
Restriction | When defining overlapping primary key and foreign key constraints, the variables in a data file are part of both a primary key and a foreign key definition. If you use the exact same variables, then the variables must be defined in a different order. The foreign key's update and delete referential actions must both be RESTRICT. |
specifies that column does not contain a null or missing value, including special missing values.
specifies one or more primary key columns, that is, columns that do not contain missing values and whose values are unique.
Restriction | When you are defining overlapping primary key and foreign key constraints, the variables in a data file are part of both a primary key definition and a foreign key definition. If you use the exact same variables, then the variables must be defined in a different order. |
specifies that the values of each column must be unique. This constraint is identical to DISTINCT.
consists of
deletes each column from the table.
deletes the integrity constraint that is referenced by each constraint-name. To find the name of an integrity constraint, use the DESCRIBE TABLE CONSTRAINTS clause. (See DESCRIBE Statement.)
specifies the text of an error message that is written to the log when the integrity constraint is not met. The maximum length of message-string is 250 characters.
changes one or more attributes of the column that is specified in each column-definition.
specifies the type of action to be performed on all matching foreign key values.
allows primary key data values to be updated, and updates matching values in the foreign key to the same values. This referential action is currently supported for updates only.
prevents the update or deletion of primary key data values if a matching value exists in the foreign key. This referential action is the default.
allows primary key data values to be updated, and sets all matching foreign key values to NULL.
specifies a SAS WHERE clause. Do not include the WHERE keyword in the WHERE clause.