Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
SQL/VIEW_COLUMNS_INDEXES.sql
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
30 lines (22 sloc)
604 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
list the columns included in indexes | |
alexis.comte@capit.net | |
*/ | |
CREATE view [dbo].[VIEW_COLUMNS_INDEXES] | |
as | |
select | |
o.name as table_name, | |
col.name as column_name, | |
i.name as index_name, | |
i.is_unique, | |
i.is_primary_key, | |
i.type as is_clustered, i.type_desc, | |
c.index_column_id, c.is_descending_key, c.is_included_column, | |
c.key_ordinal | |
from sys.indexes i | |
inner join sysobjects o on i.object_id = o.id | |
inner join sys.index_columns c on c.object_id = o.id | |
and c.index_id = i.index_id | |
inner join syscolumns col on col.id = o.id | |
and c.column_id = col.colid | |
GO | |