The below script is used to print out the individual DBCC SHOW_STATISTICS statements, but it can easily be converted for DBCC DBREINDEX. It also is written in such a way that if there are multiple owners of tables (dbo and others) that it will account for that too. This should get you started:SET NOCOUNT ONDECLARE @TableName sysnameDECLARE @IndexName sysnameDECLARE show_statistics CURSOR FOR SELECT T.name, I.name FROM SYSOBJECTS T INNER JOIN SYSINDEXES I ON T.id = I.id AND T.name <> I.name WHERE T.type = 'U' AND T.status > -1 AND I.name NOT IN ( SELECT SI.name FROM SYSOBJECTS O INNER JOIN SYSINDEXES SI ON O.name = SI.name WHERE O.xtype IN ('PK', 'F') ) ORDER BY I.nameOPEN show_statisticsFETCH NEXT FROM show_statistics INTO @TableName, @IndexNameWHILE @@FETCH_STATUS = 0 BEGIN IF (SELECT INDEXPROPERTY(OBJECT_ID(@TableName), @IndexName, 'IsStatistics')) = 0 PRINT 'DBCC SHOW_STATISTICS (' + @TableName + ', ' + @IndexName + ')' ELSE IF (SELECT INDEXPROPERTY(OBJECT_ID('USER1.' + @TableName), @IndexName, 'IsStatistics')) = 0 BEGIN PRINT 'DBCC SHOW_STATISTICS ([USER1.' + @TableName + '], ' + @IndexName + ')' END ELSE IF (SELECT INDEXPROPERTY(OBJECT_ID('USER2.' + @TableName), @IndexName, 'IsStatistics')) = 0 BEGIN PRINT 'DBCC SHOW_STATISTICS ([USER2.' + @TableName + '], ' + @IndexName + ')' END FETCH NEXT FROM show_statistics INTO @TableName, @IndexName ENDCLOSE show_statisticsDEALLOCATE show_statisticsTara