重新组织索引: alter index idx_OrderID on dbo.OrderDetail reorganize | reorganize;---可以rebuild 也可以reorganize. go 重建表: alter table OrderDetail rebuild;----只可以rebuild ! go…
SQL Server 版本是 2008 R2. 查询数据库索引碎片情况的 SQL 语句(来源): SELECT OBJECT_NAME(ind.OBJECT_ID) AS TableName, ind.name AS IndexName, indexstats.index_type_desc AS IndexType, indexstats.avg_fragmentation_in_percent FROM sys.dm_db_index_physical_stats(DB_ID(), NULL…