Mega Code Archive

 
Categories / MSSQL Tutorial / Sequence Indentity
 

IDENTITYNOT NULLPRIMARY KEY

12>  CREATE TABLE customer 13> ( 14> cust_id      int            IDENTITY  NOT NULL  PRIMARY KEY, 15> cust_name    varchar(30)    NOT NULL 16> ) 17> GO 1> 2> EXEC sp_helpconstraint customer 3> GO Object Name -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- customer constraint_type                                                                                                                                    constraint_name                                                                             delete_action update_action status_enabled status_for_replication constraint_keys -------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------- --------------------------------------------------------------------------- ------------- ------------- -------------- ---------------------- ---------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------- PRIMARY KEY (clustered)                                                                                                                            PK__customer__383021B8                                                                             (n/a)         (n/a)         (n/a)          (n/a)                  cust_id No foreign keys reference table 'customer', or you do not have permissions on referencing tables. 1> 2> drop table customer; 3> GO