SELECT
t.name AS TableName,
i.name AS IndexName,
ic.column_id,
c.name AS ColumnName,
i.type_desc
FROM
sys.tables t
INNER JOIN
sys.indexes i ON t.object_id = i.object_id
LEFT JOIN
sys.index_columns ic ON i.object_id = ic.object_id AND i.index_id = ic.index_id
LEFT JOIN
sys.columns c ON ic.object_id = c.object_id AND ic.column_id = c.column_id
WHERE
t.name = 'dwd_contractlist_ext'
ORDER BY
i.name, ic.key_ordinal;
SQL server 查看某张表的索引
于 2024-08-28 19:38:50 首次发布