sp_helpindex for Votes and Users


Please login or register to vote for this query.

(click on this box to dismiss)

Earth Science

Q&A for those interested in the geology, meteorology, oceanography, and environmental sciences

-- sp_helpindex 'Users'
select object_name(i.object_id) [table]
     , i.name [index name]
     , i.type_desc
     , co.name [column name]
     , case ico.key_ordinal 
         when 0 then 'included'
         else 'key col'
     --, i.*
     --, ico.* 
from sys.indexes i
inner join sys.index_Columns ico 
   on ico.object_id = i.object_id and ico.index_id = i.index_id
inner join sys.columns co 
   on co.object_id = i.object_id 
   and co.column_id = ico.column_id
where object_name(i.object_id) in ( 
  , 'Users' 
  -- , 'PostHistory' 
order by i.object_id
       , i.index_id
       , case ico.key_ordinal 
         when 0 then 4096
         else ico.key_ordinal 

select *
from sys.columns

Enter Parameters

Switch to meta site
loading Hold tight while we fetch your results