if want to get the index/constraint information from a table... where would i look?

  • i'm trying to put together some kind of script

    which will basically capture all the constraints/indexes from

    an existing table.

    how can i achieve this? i'm not sure if information_schema has it

    available, and I know that sysindexes has some information, but no

    table names.

    thoughts?

    _________________________

  • check the information_schema views OR

    sys.indexes,sys.index_columns, sys.check_constraints, sys.key_constraints,sys.columns and sys.tables, etc

  • SELECT OBJECT_NAME(id), name

    FROM sysindexes

    WHERE OBJECT_NAME(id) NOT LIKE'sys%'

    AND indid > 0

    AND indid < 255

    ORDER BY 1, 2

    Note: table functions where the result set table has an index will also be returned here. See ObjectProperty in BOL for more help in limiting results.

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

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