Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_column_privileges_rowset

  No additional text.


Syntax

create procedure sys.sp_column_privileges_rowset
(
    @table_name         sysname,
    @table_schema       sysname = null,
    @column_name        sysname = null,
    @grantor            sysname = null,
    @grantee            sysname = null
)
as
    select -- Rows for explicitly set database permissions.
        GRANTOR         = s_cpsv.GRANTOR,
        GRANTEE         = s_cpsv.GRANTEE,
        TABLE_CATALOG   = s_cpsv.TABLE_CATALOG,
        TABLE_SCHEMA    = s_cpsv.TABLE_SCHEMA,
        TABLE_NAME      = s_cpsv.TABLE_NAME,
        COLUMN_NAME     = s_cpsv.COLUMN_NAME,
        COLUMN_GUID     = s_cpsv.COLUMN_GUID,
        COLUMN_PROPID   = s_cpsv.COLUMN_PROPID,
        PRIVILEGE_TYPE  = s_cpsv.PRIVILEGE_TYPE,
        IS_GRANTABLE    = s_cpsv.IS_GRANTABLE
    from
        sys.spt_column_privileges_set_view s_cpsv
    where
        (
            (@table_schema is null and s_cpsv.TABLE_NAME = @table_name) or
            s_cpsv.object_id = object_id(quotename(@table_schema) + '.' + quotename(@table_name))
        ) and
        (@column_name is null or @column_name = s_cpsv.COLUMN_NAME) and
        (@grantor is null or @grantor = s_cpsv.GRANTOR) and
        (@grantee is null or @grantee = s_cpsv.GRANTEE)

    union all

    select -- Add rows for table owner
        GRANTOR         = s_cpov.GRANTOR,
        GRANTEE         = s_cpov.GRANTEE,
        TABLE_CATALOG   = s_cpov.TABLE_CATALOG,
        TABLE_SCHEMA    = s_cpov.TABLE_SCHEMA,
        TABLE_NAME      = s_cpov.TABLE_NAME,
        COLUMN_NAME     = s_cpov.COLUMN_NAME,
        COLUMN_GUID     = s_cpov.COLUMN_GUID,
        COLUMN_PROPID   = s_cpov.COLUMN_PROPID,
        PRIVILEGE_TYPE  = s_cpov.PRIVILEGE_TYPE,
        IS_GRANTABLE    = s_cpov.IS_GRANTABLE
    from
        sys.spt_column_privileges_owner_view s_cpov
    where
        (
            (@table_schema is null and s_cpov.TABLE_NAME = @table_name) or
            s_cpov.object_id = object_id(quotename(@table_schema) + '.' + quotename(@table_name))
        ) and
        (@column_name is null or @column_name = s_cpov.COLUMN_NAME) and
        (@grantor is null or @grantor = s_cpov.GRANTOR) and
        (@grantee is null or @grantee = s_cpov.GRANTEE)

    order by 4, 5, 6, 9, 1, 2

 
Last revision 2008RTM
See also

  sp_column_privileges_rowset2 (Procedure)
sp_column_privileges_rowset_rmt (Procedure)
       



News

  Query a named instance
Sybase+ASE+silent+install
SQL 2008 R2
Deprecated procedures in SQL2008
Reporting Services item-level role definitions
Create all your missing indexes
Converting datetime field
Start MSSQL Server Profiler at time
Replicating MSSQL Server views
Exploring Microsoft Sharepoint
The OLE DB provider "SQLNCLI10" for linked server indicates.
Mobile solar charger
Oracle to SQL Server replication
Cannot insert the value NULL into column
Undocumented Microsoft SQL Server 2008
VMware
Zoekmachine optimalisatie
SQL Servers hidden objects
FckEditor
Flash in Ajax
De hype die AJAX heet
Barcode scannen
MySQL; Gratis, makkelijk en snel!
PHP
sIFR; de combinatie tussen HTML en Flash