April 30, 2012

sp_indexes_rowset (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_indexes_rowset(nvarchar @table_name
, nvarchar @index_name
, nvarchar @table_schema)

MetaData:

   
create procedure sys.sp_indexes_rowset
(
@table_name sysname,
@index_name sysname = null,
@table_schema sysname = null
)
as
select
TABLE_CATALOG = s_iv.TABLE_CATALOG,
TABLE_SCHEMA = s_iv.TABLE_SCHEMA,
TABLE_NAME = s_iv.TABLE_NAME,
INDEX_CATALOG = s_iv.INDEX_CATALOG,
INDEX_SCHEMA = s_iv.INDEX_SCHEMA,
INDEX_NAME = s_iv.INDEX_NAME,
PRIMARY_KEY = s_iv.PRIMARY_KEY,
[UNIQUE] = s_iv.[UNIQUE],
[CLUSTERED] = s_iv.[CLUSTERED],
[TYPE] = s_iv.[TYPE],
FILL_FACTOR = s_iv.FILL_FACTOR,
INITIAL_SIZE = s_iv.INITIAL_SIZE,
NULLS = s_iv.NULLS,
SORT_BOOKMARKS = s_iv.SORT_BOOKMARKS,
AUTO_UPDATE = s_iv.AUTO_UPDATE,
NULL_COLLATION = s_iv.NULL_COLLATION,
ORDINAL_POSITION = s_iv.ORDINAL_POSITION,
COLUMN_NAME = s_iv.COLUMN_NAME,
COLUMN_GUID = s_iv.COLUMN_GUID,
COLUMN_PROPID = s_iv.COLUMN_PROPID,
[COLLATION] = s_iv.[COLLATION],
CARDINALITY = s_iv.CARDINALITY,
PAGES = s_iv.PAGES,
FILTER_CONDITION = s_iv.FILTER_CONDITION,
INTEGRATED = s_iv.INTEGRATED

from
sys.spt_indexes_view s_iv

where
(
(@table_schema is null and s_iv.TABLE_NAME = @table_name) or
s_iv.object_id = object_id(quotename(@table_schema) + '.' + quotename(@table_name))
) and
(@index_name is null or @index_name = s_iv.INDEX_NAME)

order by 8, 10, 4, 5, 6, 17

No comments:

Post a Comment

Total Pageviews