title: How to get the Index Name from IndexId in SQL Server 2005
body: <p>I'm running the following query to list size and fragmentation of the indexes:</p>
  
  <pre><code>SELECT object_name(object_id, database_id) as objectname), index_id, *
  FROM sys.dm_db_index_usage_stats
  </code></pre>
  
  <p>Is there an SQL function I can use to convert the <code>index_id</code> to the index name?</p>