April 17, 2012

sp_column_privileges_ex (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_column_privileges_ex(nvarchar @table_server
, nvarchar @table_name
, nvarchar @table_schema
, nvarchar @table_catalog
, nvarchar @column_name)

MetaData:

   
create procedure sys.sp_column_privileges_ex
(
@table_server sysname,
@table_name sysname = null,
@table_schema sysname = null,
@table_catalog sysname = null,
@column_name sysname = null
)
as
select
TABLE_CAT = TABLE_CATALOG,
TABLE_SCHEM = TABLE_SCHEMA,
TABLE_NAME = TABLE_NAME,
COLUMN_NAME = COLUMN_NAME,
GRANTOR = GRANTOR,
GRANTEE = GRANTEE,
PRIVILEGE = PRIVILEGE_TYPE,
IS_GRANTABLE = case IS_GRANTABLE
when 1 then 'YES'
when 0 then 'NO'
else null
end
from sys.fn_remote_column_privileges(@table_server,
@table_catalog,
@table_schema,
@table_name,
NULL,
NULL,
NULL)
where
(COLUMN_NAME like @column_name or @column_name is NULL)
order by TABLE_CAT, TABLE_SCHEM, TABLE_NAME, COLUMN_NAME, PRIVILEGE

No comments:

Post a Comment

Total Pageviews