标签:
查看一个表的Index info
1,Script1
--query index in a table
select o.name,o.object_id,
i.name as indexname,i.index_id,i.type_desc,
ic.column_id,ic.is_included_column,ic.key_ordinal as Index_column_Ordinal,
c.name as columnname
from sys.objects o
inner join sys.indexes i on o.object_id=i.object_id
inner join sys.index_columns ic on i.object_id=ic.object_id and i.index_id=ic.index_id
inner join sys.columns c on o.object_id=c.object_id and ic.column_id=c.column_id
where o.name=‘FactProduct‘
order by i.index_id
2,Script2
--query index in a table include filter index select o.name,o.object_id, i.name as indexname,i.index_id,i.type_desc, ic.column_id,ic.is_included_column,ic.key_ordinal as Index_column_Ordinal, c.name as columnname, i.has_filter,i.filter_definition from sys.objects o inner join sys.indexes i on o.object_id=i.object_id inner join sys.index_columns ic on i.object_id=ic.object_id and i.index_id=ic.index_id inner join sys.columns c on o.object_id=c.object_id and ic.column_id=c.column_id where o.name=‘factProduct‘ order by i.index_id
标签:
原文地址:http://www.cnblogs.com/ljhdo/p/5124012.html