Mega Code Archive

 
Categories / MSSQL / Store Procedure Function
 

EXEC sp_help name

To view the properties of the sales table, we just have to type the following into the Query Analyzer: 8> CREATE TABLE stores( 9>    stor_id        char(4)           NOT NULL, 10>    stor_name      varchar(40)           NULL, 11>    stor_address   varchar(40)           NULL, 12>    city           varchar(20)           NULL, 13>    state          char(2)               NULL, 14>    zip            char(5)               NULL 15> ) 16> GO 1>    EXEC sp_help stores 2>    GO Name                                                                                                                             Owner                                                           Type                            Created_datetime -------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------- --------------------------------------------------------- ------------------------------- ----------------------- stores                                                                                                                           dbo                                                           user table                      2008-08-17 13:04:38.290 Column_name                                                                                                                      Type                                                           Computed                            Length      Prec  Scale Nullable                            TrimTrailingBlanks                  FixedLenNu llInSource                Collation -------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------- --------------------------------------------------------- ----------------------------------- ----------- ----- ----- ----------------------------------- ----------------------------------- ---------- ------------------------- -------------------------------------------------------------------------------------------------------------------------------- stor_id                                                                                                                          char                                                           no                                            4             no                                  no                                  no                           SQL_Latin1_General_CP1_CI_AS stor_name                                                                                                                        varchar                                                           no                                           40             yes                                 no                                  yes                           SQL_Latin1_General_CP1_CI_AS stor_address                                                                                                                     varchar                                                           no                                           40             yes                                 no                                  yes                           SQL_Latin1_General_CP1_CI_AS city                                                                                                                             varchar                                                           no                                           20             yes                                 no                                  yes                           SQL_Latin1_General_CP1_CI_AS state                                                                                                                            char                                                           no                                            2             yes                                 no                                  yes                           SQL_Latin1_General_CP1_CI_AS zip                                                                                                                              char                                                           no                                            5             yes                                 no                                  yes                           SQL_Latin1_General_CP1_CI_AS Identity                                                                                                                         Seed                                     Increment            Not For Replication -------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------- ------------------------------ ---------- ------------------- No identity column defined.                                                                                                                                          NULL       NULL                NULL RowGuidCol -------------------------------------------------------------------------------------------------------------------------------- No rowguidcol column defined. Data_located_on_filegroup -------------------------------------------------------------------------------------------------------------------------------- PRIMARY The object 'stores' does not have any indexes, or you do not have permissions. No constraints are defined on object 'stores', or you do not have permissions. No foreign keys reference table 'stores', or you do not have permissions on referencing tables. No views with schema binding reference table 'stores'. 1> 2> 3> drop table stores; 4> GO