Wednesday, March 7, 2012

Index definition - can you get it?

It is possible to get the definition of an index in a script?
I want the "Create index..." string so I can drop and recreate the index in a single statement.
You can do it in the Query Analyzer object browzer with the "Script object..." options.It is possible to get the definition of an index in a script?
I want the "Create index..." string so I can drop and recreate the index in a single statement.
You can do it in the Query Analyzer object browzer with the "Script object..." options.

when u script a table the script for the index is also created.|||You can get all the indexes on a table from sysindexes.
You can get all the index's properties with INDEXPROPERTY ( table_ID , index , property ).
You can get all the columns involved in an index with INDEX_COL.

See the "Change database collation - quickly" thread where the sql is built up that will create the index.

No comments:

Post a Comment