SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

The Ultimate Index Usage Reporter

By Jesse Roberge,

By Jesse Roberge - YeshuaAgapao@Yahoo.com
Update - Fixed existance check for drop

Reports index stats, index size+rows, member seek + include columns as two comma separated output columns, and index usage stats for one or more tables and/or schemas. Flexible parameterized sorting.
Has all the output of Util_ListIndexes plus the usage stats.

Update 2009-01-14:
Added IndexDepth and FillFactor output columns
Added 'Last xxx' datetime columns to the result set
Added @Delimiter parameter for the column listing output (Defaults to ,) for accomodating export to csv files.
Rearranged collumn output to match the pattern in Util_MissingIndexes. Constistant and looks better with the dates.
Removed duplicate output of 'is_unique'

Required Input Parameters

@SchemaName sysname='' Filters schemas. Can use LIKE wildcards. All schemas if blank. Accepts LIKE Wildcards.
@TableName sysname='' Filters tables. Can use LIKE wildcards. All tables if blank. Accepts LIKE Wildcards.
@Sort Tinyint=5 Determines what to sort the results by:
Value Sort Columns
1 Score DESC, user_seeks DESC, user_scans DESC
2 Score ASC, user_seeks ASC, user_scans ASC
3 SchemaName ASC, TableName ASC, IndexName ASC
4 SchemaName ASC, TableName ASC, Score DESC
5 SchemaName ASC, TableName ASC, Score ASC
@Delimiter VarChar(1)=',' Delimiter for the horizontal delimited seek and include column listings.

EXECUTE Util_IndexUsage 'dbo', 'order%', 5, '|'

Licensed under the L-GPL - a weak copyleft license - you are permitted to use this as a component of a proprietary database and call this from proprietary software.
Copyleft lets you do anything you want except plagarize, conceal the source, proprietarize modifications, or prohibit copying & re-distribution of this script/proc.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU Lesser General Public License for more details.

see <http://www.fsf.org/licensing/licenses/lgpl.html> for the license text.


Total article views: 7650 | Views in the last 30 days: 4
Related Articles

How to get schemaname, tablename, identity column, foreign key constraints

How to get schemaname, tablename, identity column, foreign key constraints


comma delimited name column

comma delimited name column


SQL – Split delimited columns using XML Or UDF function

The requirement is to convert the delimited column into rows Input data and required output details...


Executing cmd file with isqlw command imbedded, want to change output file delimiter

Analyzer configured with TAB output delimiter want to dynamically change


The Ultimate Column Searcher

Searches for columns with names containing @Colname that belong to tables with names containing @Tab...