June 11, 2012

sp_table_privileges_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_table_privileges_rowset(nvarchar @table_name
, nvarchar @table_schema
, nvarchar @grantor
, nvarchar @grantee)

MetaData:

   
create procedure sys.sp_table_privileges_rowset
(
@table_name sysname,
@table_schema sysname = null,
@grantor sysname = null,
@grantee sysname = null
)
as
select
GRANTOR = s_tpv.GRANTOR,
GRANTEE = s_tpv.GRANTEE,
TABLE_CATALOG = s_tpv.TABLE_CATALOG,
TABLE_SCHEMA = s_tpv.TABLE_SCHEMA,
TABLE_NAME = s_tpv.TABLE_NAME,
PRIVILEGE_TYPE = s_tpv.PRIVILEGE_TYPE,
IS_GRANTABLE = s_tpv.IS_GRANTABLE
from
sys.spt_table_privileges_view s_tpv
where
s_tpv.TABLE_NAME = @table_name and
(@table_schema is null or @table_schema = s_tpv.TABLE_SCHEMA) and
(@grantee is null or @grantee = s_tpv.GRANTEE) and
(@grantor is null or @grantor = s_tpv.GRANTOR)
order by 4,5,6,1,2

No comments:

Post a Comment

Total Pageviews