时间:2021-07-01 10:21:17 帮助过:5人阅读
--查找所有索引 SELECT ‘dbcc showcontig (‘ + CONVERT(VARCHAR(20), i.id) + ‘,‘ + -- table id CONVERT(VARCHAR(20), i.indid) + ‘)--‘ + --index id OBJECT_NAME(i.id) + ‘.‘ + -- table name i.name--index name FROM sysobjects o INNER JOIN sysindexes i ON ( o.id = i.id ) WHERE o.type = ‘U‘ AND i.indid < 2 AND i.id = OBJECT_ID(o.name) ORDER BY OBJECT_NAME(i.id), i.indid --结果 dbcc showcontig (2052202361,1)--AddBusiness.PK_AddBusiness
何时需要重建索引:
DBCC showcontig(‘Send‘)
SQL语句优化
标签: