Monday, May 23, 2011
Friday, May 20, 2011
indexing - List of all index & index columns in SQL Server DB - Stack Overflow
indexing - List of all index & index columns in SQL Server DB - Stack Overflow
--select * from sys.indexes
--select * From sys.index_columns
select
ind.name, ind.index_id, ic.index_column_id, col.name as indexname, t.name as tablename,
ind.*, ic.*, col.*
from
sys.indexes ind
inner join
sys.index_columns ic on
ind.object_id = ic.object_id and ind.index_id = ic.index_id
inner join
sys.columns col on
ic.object_id = col.object_id and ic.column_id = col.column_id
inner join
sys.tables t on
ind.object_id = t.object_id
where
ind.is_primary_key = 0
and ind.is_unique = 0
and ind.is_unique_constraint = 0
and t.is_ms_shipped = 0
and col.name = 'status_id'
and t.name = 'user_lo'
order by
t.name, ind.name, ind.index_id, ic.index_column_id
--select * from sys.indexes
--select * From sys.index_columns
select
ind.name, ind.index_id, ic.index_column_id, col.name as indexname, t.name as tablename,
ind.*, ic.*, col.*
from
sys.indexes ind
inner join
sys.index_columns ic on
ind.object_id = ic.object_id and ind.index_id = ic.index_id
inner join
sys.columns col on
ic.object_id = col.object_id and ic.column_id = col.column_id
inner join
sys.tables t on
ind.object_id = t.object_id
where
ind.is_primary_key = 0
and ind.is_unique = 0
and ind.is_unique_constraint = 0
and t.is_ms_shipped = 0
and col.name = 'status_id'
and t.name = 'user_lo'
order by
t.name, ind.name, ind.index_id, ic.index_column_id
Wednesday, May 04, 2011
Friday, April 29, 2011
Tuesday, April 26, 2011
Subscribe to:
Posts (Atom)