April 30, 2012

sp_indexcolumns_managed (Transact-SQL MetaData) Definition

Please note: that the following source code is provided and copyrighted by Microsoft and is for educational purpose only.
The meta data is from an SQL 2012 Server.

I have posted alot more, find the whole list here.

Goto Definition or MetaData

Definition:

sys.sp_indexcolumns_managed(nvarchar @Catalog
, nvarchar @Owner
, nvarchar @Table
, nvarchar @ConstraintName
, nvarchar @Column)

MetaData:

   
create procedure sys.sp_indexcolumns_managed
(
@Catalog sysname = NULL,
@Owner sysname = NULL,
@Table sysname = NULL,
@ConstraintName sysname = NULL,
@Column sysname = NULL
)
as
select
constraint_catalog = s_icv.constraint_catalog,
constraint_schema = s_icv.constraint_schema,
constraint_name = s_icv.constraint_name,
table_catalog = s_icv.table_catalog,
table_schema = s_icv.table_schema,
table_name = s_icv.table_name,
column_name = s_icv.column_name,
ordinal_position = convert(int, s_icv.ordinal_position),
KeyType = s_icv.KeyType,
index_name = s_icv.index_name
from
sys.spt_indexcolumns_view_managed s_icv
where
(s_icv.table_catalog = @Catalog or (@Catalog is null)) and
(s_icv.table_schema = @Owner or (@Owner is null)) and
(s_icv.table_name = @Table or (@Table is null)) and
(s_icv.index_name = @ConstraintName or (@ConstraintName is null)) and
(s_icv.column_name = @Column or (@Column is null))
order by table_name, index_name

No comments:

Post a Comment

Total Pageviews