I am new to SQL server, and I am interested in determining the fragmentation on indexes on my server. The 'DBCC Showcontig' tool seems to have the information which will be useful in deciding the level of fragmentation on an index, and I'd like to load this information into a table. However, the following code copied from Books Online is not producing the desired results: INSERT INTO #fraglist EXEC ('DBCC SHOWCONTIG (''' + @tablename + ''') WITH FAST, TABLERESULTS, ALL_INDEXES, NO_INFOMSGS') First, it is not recognizing 'FAST' and 'ALL_INDEXES' options. Second, 'TABLERESULTS' option is not producing the output as rowset with additional information. I don't know what I am doing wrong. aijaz90
Can't see what is wrong with the syntax you have there but I can point you to a script that does exactly what you are looking for: http://home.attbi.com/~bwunder/IndexMaintenanceForDB.html /Argyle