Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.spt_indexes_view_100

  No additional text.


Syntax

create view sys.spt_indexes_view_100
as
    select
    -- begin (for doing joins)
        OBJECT_ID           = o.object_id,
        SCHEMA_ID           = o.schema_id,
    -- end (for doing joins)
        TABLE_CATALOG       = db_name(),
        TABLE_SCHEMA        = schema_name(o.schema_id),
        TABLE_NAME          = o.name,
        INDEX_CATALOG       = db_name(),
        INDEX_SCHEMA        = schema_name(o.schema_id),
        INDEX_NAME          = x.name,
        PRIMARY_KEY         = x.is_primary_key,
        "UNIQUE"            = x.is_unique,
        "CLUSTERED"         = convert(bit,case when x.index_id = 1 then 1 else 0 end),
        "TYPE"              = convert(smallint, 1), -- DBPROPVAL_IT_BTREE
        FILL_FACTOR         = convert(int, x.fill_factor),
        INITIAL_SIZE        = convert(int,null),
        NULLS               = convert(int,null),
        SORT_BOOKMARKS      = convert(bit,0),
        AUTO_UPDATE         = convert(bit,1),
        NULL_COLLATION      = convert(int,4), -- DBPROPVAL_NC_LOW
        ORDINAL_POSITION    = convert(int,
                    case
                      when x.type < 3 then s_ic.key_ordinal
                      else 1            -- use 1 as the column ordinal for single column indexes
                    end),
        COLUMN_NAME         = col_name(o.object_id, s_ic.column_id),
        COLUMN_GUID         = convert(uniqueidentifier,null),
        COLUMN_PROPID       = convert(int,null),
        "COLLATION"         = convert(smallint,
                                        case
                                        when s_ic.is_descending_key = 1
                                        then 2 -- DB_COLLATION_DESC
                                        else 1 -- DB_COLLATION_ASC
                                        end),
        CARDINALITY         = case
                                when x.is_unique = 1 then
                                    convert (int, 0x7FFFFFFF & p.rows)  -- handle overflow
                                else
                                    null
                              end,
        PAGES               = p.data_pages,
        FILTER_CONDITION    = convert(nvarchar(1),null),
        INTEGRATED          = convert(bit,case when x.index_id = 1 then 1 else 0 end),
        STATUS              = convert(int, IndexProperty(o.object_id, x.name, 'isfulltextkey'))

    from
        sys.indexes x inner join
        sys.objects o on -- Yukon doesn't expose indexes on its system objects, so only user objects are useful.
            (
                x.object_id = o.object_id and
                x.is_hypothetical = 0
            ) inner join
        sys.index_columns s_ic on
            (
                x.index_id = s_ic.index_id and
                o.object_id = s_ic.object_id
            ) left join
        sys.index_counts p on
            (
                p.object_id = x.object_id and
                p.index_id = x.index_id
            )
    where
        s_ic.key_ordinal > 0 OR x.type = 3 OR x.type = 4
    -- exclude INCLUDE and Partitioned index columns, but include xml and spatial indexes which don't include "key" columns


 
Last revision 2008RTM
See also

  sp_indexes_100_rowset (Procedure)
sp_indexes_100_rowset2 (Procedure)
       



News

  Query a named instance
Sybase+ASE+silent+install
SQL 2008 R2
Deprecated procedures in SQL2008
Reporting Services item-level role definitions
Create all your missing indexes
Converting datetime field
Start MSSQL Server Profiler at time
Replicating MSSQL Server views
Exploring Microsoft Sharepoint
The OLE DB provider "SQLNCLI10" for linked server indicates.
Mobile solar charger
Oracle to SQL Server replication
Cannot insert the value NULL into column
Undocumented Microsoft SQL Server 2008
VMware
Zoekmachine optimalisatie
SQL Servers hidden objects
FckEditor
Flash in Ajax
De hype die AJAX heet
Barcode scannen
MySQL; Gratis, makkelijk en snel!
PHP
sIFR; de combinatie tussen HTML en Flash