Mega Code Archive

 
Categories / MSSQL Tutorial / System Functions
 

EXEC sp_helpconstraint table name

9>     CREATE TABLE Customers 10>    ( 11>       CustomerNo     int     IDENTITY   NOT NULL 12>          PRIMARY KEY, 13>       CustomerName   varchar(30)        NOT NULL, 14>       Address1       varchar(30)        NOT NULL, 15>       Address2       varchar(30)        NOT NULL, 16>      City            varchar(20)        NOT NULL, 17>      State           char(2)            NOT NULL, 18>      Zip             varchar(10)        NOT NULL, 19>      Contact         varchar(25)        NOT NULL, 20>      Phone           char(15)           NOT NULL, 21>      FedIDNo         varchar(9)         NOT NULL, 22>      DateInSystem    smalldatetime      NOT NULL 23>    ) 24>    GO 1> 2>    EXEC sp_helpconstraint Customers 3>    GO Object Name -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Customers constraint_type                                                                                                                                    constraint_name                                                                             delete_action update_action status_enabled status_for_replication constraint_keys -------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------- --------------------------------------------------------------------------- ------------- ------------- -------------- ---------------------- ---------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------- PRIMARY KEY (clustered)                                                                                                                            PK__Customers__40E5634A                                                                             (n/a)         (n/a)         (n/a)          (n/a)                  CustomerID No foreign keys reference table 'Customers', or you do not have permissions on referencing tables. 1> 2>    drop table Customers; 3>    GO 1> 2>