create index ... include (colx)

  • Just looking at the new include syntax (from 05 on).

    Can't figure out where I can see which columns have been 'included' in an index.

    These all show only the index column. Not the extra column covered by the include syntax.

    sp_help

    sp_helpindex.

    sysindexes

    Am I missing something obvious?

  • elect c.name, ic.*

    from sys.index_columns ic

    join sys.indexes i

    on i.object_id = ic.object_id

    and i.index_id = ic.index_id

    join sys.columns c

    on c.object_id = i.object_id

    and c.column_id = ic.column_id

    where i.name = '[IndexName]'

    and i.object_id = object_id('[TableName]')

    and ic.is_included_column = 1

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • great, thanks. that's perfect.

  • You can use XDetails Addin to see included columns and other details:

    _____________________________________________________
    Microsoft Certified Master: SQL Server 2008
    XDetails Addin - for SQL Developers
    blog.sqlxdetails.com - Transaction log myths

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply