EXEC sp_help on a table : sp_help « System Functions « SQL Server / T-SQL Tutorial






4>    CREATE TABLE Customers
5>    (
6>       CustomerNo    int         IDENTITY  NOT NULL,
7>       CustomerName  varchar(30)                NOT NULL,
8>       Address1      varchar(30)                NOT NULL,
9>       Address2      varchar(30)                NOT NULL,
10>       City          varchar(20)                NOT NULL,
11>       State         char(2)                    NOT NULL,
12>       Zip           varchar(10)                NOT NULL,
13>       Contact       varchar(25)                NOT NULL,
14>       Phone         char(15)                   NOT NULL,
15>       FedIDNo       varchar(9)                 NOT NULL,
16>       DateInSystem  smalldatetime              NOT NULL
17>    )
18>    GO
1>    EXEC sp_help Customers
2> GO
Name                                                                                                                             Owner
                                                          Type                            Created_datetime
-------------------------------------------------------------------------------------------------------------------------------- -----------------------------------------------------------------------
--------------------------------------------------------- ------------------------------- -----------------------
Customers                                                                                                                        dbo
                                                          user table                      2008-08-18 20:36:02.103


Column_name                                                                                                                      Type
                                                          Computed                            Length      Prec  Scale Nullable                            TrimTrailingBlanks                  FixedLenNu
llInSource                Collation
-------------------------------------------------------------------------------------------------------------------------------- -----------------------------------------------------------------------
--------------------------------------------------------- ----------------------------------- ----------- ----- ----- ----------------------------------- ----------------------------------- ----------
------------------------- --------------------------------------------------------------------------------------------------------------------------------
CustomerNo                                                                                                                       int
                                                          no                                            4 10    0     no                                  (n/a)                               (n/a)
                          NULL
CustomerName                                                                                                                     varchar
                                                          no                                           30             no                                  no                                  no
                          SQL_Latin1_General_CP1_CI_AS
Address1                                                                                                                         varchar
                                                          no                                           30             no                                  no                                  no
                          SQL_Latin1_General_CP1_CI_AS
Address2                                                                                                                         varchar
                                                          no                                           30             no                                  no                                  no
                          SQL_Latin1_General_CP1_CI_AS
City                                                                                                                             varchar
                                                          no                                           20             no                                  no                                  no
                          SQL_Latin1_General_CP1_CI_AS
State                                                                                                                            char
                                                          no                                            2             no                                  no                                  no
                          SQL_Latin1_General_CP1_CI_AS
Zip                                                                                                                              varchar
                                                          no                                           10             no                                  no                                  no
                          SQL_Latin1_General_CP1_CI_AS
Contact                                                                                                                          varchar
                                                          no                                           25             no                                  no                                  no
                          SQL_Latin1_General_CP1_CI_AS
Phone                                                                                                                            char
                                                          no                                           15             no                                  no                                  no
                          SQL_Latin1_General_CP1_CI_AS
FedIDNo                                                                                                                          varchar
                                                          no                                            9             no                                  no                                  no
                          SQL_Latin1_General_CP1_CI_AS
DateInSystem                                                                                                                     smalldatetime
                                                          no                                            4             no                                  (n/a)                               (n/a)
                          NULL

Identity                                                                                                                         Seed                                     Increment
           Not For Replication
-------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------- ------------------------------
---------- -------------------
CustomerNo                                                                                                                                                              1
         1                   0

RowGuidCol
--------------------------------------------------------------------------------------------------------------------------------
No rowguidcol column defined.

Data_located_on_filegroup
--------------------------------------------------------------------------------------------------------------------------------
PRIMARY

The object 'Customers' does not have any indexes, or you do not have permissions.

No constraints are defined on object 'Customers', or you do not have permissions.

No foreign keys reference table 'Customers', or you do not have permissions on referencing tables.
No views with schema binding reference table 'Customers'.
1>
2> drop table Customers;
3> GO
1>








25.41.sp_help
25.41.1.The system procedure sp_help displays information about one or more database objects.
25.41.2.EXEC sp_help on a table
25.41.3.Display table structure before and after altering command