sp_statistics

Description

Returns a list of indexes on a single table.

Syntax

sp_statistics table_name [, table_owner] 
	[, table_qualifier] [, index_name] [, is_unique]

Parameters

table_name

is the name of the table. The use of wildcard character pattern matching is not supported.

table_owner

is the owner of the table. The use of wildcard character pattern matching is not supported. If table_owner is not specified, sp_statistics looks for a table owned by the current user and then for a table owned by the Database Owner.

table_qualifier

is the name of the database. This can be either the current database or NULL.

index_name

is the index name. The use of wildcard character pattern matching is not supported.

is_unique

is Y to return only unique indexes; otherwise, is N to return both unique and nonunique indexes.

Examples

Example 1

sp_statistics publishers

table_qualifier                  table_owner
    table_name                       non_unique
    index_qualifier                  index_name
    type   seq_in_index column_name                     collation
    cardinality pages       
-------------------------------- --------------------------------
   -------------------------------- ---------- 
   -------------------------------- ---------------------------
   ------ ------------ -------------------------------- -------- 
   ----------- ----------- 
pubs2                            dbo
    publishers                       NULL
    NULL                             NULL
        0         NULL NULL                             NULL
             3           1 
pubs2                            dbo
    publishers                                0
    publishers                       pubind
         1            1 pub_id                           A
             3           1 

Usage

Permissions

Any user can execute sp_statistics.