SQL Server数据库所有表索引性能分析

与上一篇《SQL Server数据库所有表重建索引》相似,这一段存储过程只是更改了一条语句“DBCC showcontig(@name)” ,用来显示每个数据表的索引性能信息,方便评估当前数据库的整体性能。

 

USE  My_Database;
DECLARE   @name   varchar ( 100

DECLARE  authors_cursor  CURSOR   FOR   
Select   [ name ]     from  sysobjects  where  xtype = ' u '   order   by  id 

OPEN  authors_cursor 

FETCH   NEXT   FROM  authors_cursor   INTO   @name  

WHILE   @@FETCH_STATUS   =   0  
BEGIN      

   
DBCC  showcontig( @name )
   
FETCH   NEXT   FROM  authors_cursor  
   
INTO   @name  
END  

deallocate  authors_cursor

你可能感兴趣的:(SQL Server)