June 13, 2012

sp_tables_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_tables_rowset(nvarchar @table_name
, nvarchar @table_schema
, nvarchar @table_type)

MetaData:

   
create procedure sys.sp_tables_rowset
(
@table_name sysname,
@table_schema sysname = null,
@table_type nvarchar(255) = null
)
as
select
TABLE_CATALOG = s_tr.TABLE_CATALOG,
TABLE_SCHEMA = s_tr.TABLE_SCHEMA,
TABLE_NAME = s_tr.TABLE_NAME,
TABLE_TYPE = s_tr.TABLE_TYPE,
TABLE_GUID = s_tr.TABLE_GUID,
DESCRIPTION = s_tr.DESCRIPTION,
TABLE_PROPID = s_tr.TABLE_PROPID,
DATE_CREATED = s_tr.DATE_CREATED,
DATE_MODIFIED = s_tr.DATE_MODIFIED
from
sys.spt_tables_view s_tr
where
(
(@table_schema is null and s_tr.TABLE_NAME = @table_name) or
object_id(quotename(@table_schema) + '.' + quotename(@table_name)) = s_tr.object_id
) and
(@table_type is null or @table_type = s_tr.TABLE_TYPE)
order by 4, 2, 3

No comments:

Post a Comment

Total Pageviews