June 13, 2012

sp_views_rowset2 (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_views_rowset2(nvarchar @view_schema)

MetaData:

   
create procedure sys.sp_views_rowset2
(
@view_schema sysname = null
)
as
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -
-- copy & pasted from version 1 of the SProc and removed checks for 1st parameter !
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -
select
TABLE_CATALOG = db_name(),
TABLE_SCHEMA = schema_name(a_v.schema_id),
TABLE_NAME = a_v.name,
VIEW_DEFINITION = convert(nvarchar(1),null),
CHECK_OPTION = convert(bit, NULL),
IS_UPDATABLE = convert(bit, NULL),
DESCRIPTION = convert(nvarchar(1),null),
DATE_CREATED = a_v.create_date,
DATE_MODIFIED = convert(datetime,null)
from
sys.all_views a_v
where
(@view_schema is null or schema_id(@view_schema) = a_v.schema_id) and
has_perms_by_name(quotename(schema_name(a_v.schema_id)) + '.' + quotename(a_v.name),
'object',
'select') = 1
order by 1, 2, 3

No comments:

Post a Comment

Total Pageviews