sql server中,如何查询一张表建立过哪些索引,不用视图,用SQL语句...
发布网友
发布时间:2022-04-24 05:35
我来回答
共2个回答
热心网友
时间:2022-04-10 09:02
直接在查询分析器中就可以看,按F8,展开左边的树,选中一张便,看它下面的“索引”节点,里面有你所有的聚簇索引和非聚簇索引
热心网友
时间:2022-04-10 10:20
SELECT
tab.name AS [表名],
idx.name AS [索引名称],
col.name AS [列名]
FROM
sys.indexes idx
JOIN sys.index_columns idxCol
ON (idx.object_id = idxCol.object_id
AND idx.index_id = idxCol.index_id
)
JOIN sys.tables tab
ON (idx.object_id = tab.object_id)
JOIN sys.columns col
ON (idx.object_id = col.object_id
AND idxCol.column_id = col.column_id);