Microsoft® SQL Server® 2012 Bible

(Ben Green) #1

991


Chapter 43: Management Data Warehouse


43


,IndexName
,AvgFragmentationPct
)
Execute sp_executesql @Query;

FETCH NEXT FROM DB_Cursor INTO @DB_ID, @DB_Name;
END;
CLOSE DB_Cursor;
DEALLOCATE DB_Cursor;

SELECT * FROM @TblOutput</Value>
<OutputTable>clustered_index_fragmentation</OutputTable>
</Query>
</ns:TSQLQueryCollector>',
@collection_item_id = @collection_item_id OUTPUT,
@frequency = 5, -- This parameter is ignored in cached mode
@collection_set_id = @collection_set_id,
@collector_type_uid = @collector_type_uid;
SELECT @collection_item_id;

The new data collector named Clustered Index Fragmentation is listed under the Data
Collection section, as shown in Figure 43-15.

FIGURE 43-15
Custom Data Collector.

c43.indd 991c43.indd 991 7/31/2012 10:18:46 AM7/31/2012 10:18:46 AM


http://www.it-ebooks.info
Free download pdf