是否有系統SP或dmv允許我根據列和表名選擇索引在我的數據庫中?根據列/表名選擇索引
我想要做的是刪除索引基於字符串數據類型的列,因爲我正在改變我的排序規則設置的過程。
謝謝。
SELECT
i.Name 'Index Name',
OBJECT_NAME(i.object_ID) 'Table Name',
c.Name 'Column Name'
FROM
sys.indexes i
INNER JOIN
sys.index_columns ic ON i.index_id = ic.index_id AND i.object_id = ic.object_id
INNER JOIN
sys.columns c ON ic.column_id = c.column_id AND ic.object_id = c.object_id
WHERE
c.name = 'Index column name' -- this for a column name
-- OBJECT_NAME(i.OBJECT_ID) = 'Table Name' -- this for table name
馬克
輝煌,謝謝! – super9 2009-07-13 15:49:07