Displaying Integrity Constraints for a Table

Overview

Sometimes you want to add data to a table but you are not sure what integrity constraints, if any, the table has. To display only the integrity constraints for a specified table, use a DESCRIBE TABLE CONSTRAINTS statement. (The DESCRIBE TABLE statement, which is discussed earlier in this chapter, lists both a CREATE TABLE statement and the table's integrity constraints in the SAS log.)
Note: Some versions of SAS display information about integrity constraints in output as well as in the SAS log.
General form, DESCRIBE TABLE CONSTRAINTS statement:
DESCRIBE TABLE CONSTRAINTS table-name-1<, ... table-name-n>;
Here is an explanation of the syntax:
table-name
specifies the table to be described as one of the following:
  • a one-level name
  • a two-level libref.table name
  • a physical pathname that is enclosed in single quotation marks.

Example

To display only the table constraints for the table Work.Discount4 that was created earlier, you submit the following PROC SQL step:
proc sql;
   describe table constraints work.discount4;
Table 5.16 SAS Log
NOTE: SQL table WORK.DISCOUNT4 ( bufsize=4096 ) has the 
following integrity constraint(s):

-----Alphabetic List of Integrity Constraints-----

      Integrity                            Where
   *  Constraint    Type      Variables    Clause
-------------------------------------------------
1     notnull_dest Not Null Destination
2     ok_discount Check Discount<=0.5
Work.Discount4
As shown, Work.Discount4 has two integrity constraints: NotNull_Dest and OK_Discount.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.21.159.82