Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.spt_column_privileges_set_view

  No additional text.


Syntax

create view sys.spt_column_privileges_set_view
as
    select -- Rows for explicitly set database permissions.
    -- begin (for doing joins)
        OBJECT_ID       = o.object_id,
        SCHEMA_ID       = o.schema_id,
    -- end (for doing joins)
        GRANTOR         = user_name(p.grantor_principal_id),
        GRANTEE         = user_name(u.principal_id),
        TABLE_CATALOG   = db_name(),
        TABLE_SCHEMA    = schema_name(o.schema_id),
        TABLE_NAME      = o.name,
        COLUMN_NAME     = c.name,
        COLUMN_GUID     = convert(uniqueidentifier,null),
        COLUMN_PROPID   = convert(int,null),
        PRIVILEGE_TYPE  = convert(nvarchar(30),
                                  case p.type
                                      when 'SL' then N'SELECT'
                                      when 'IN' then N'INSERT'
                                      when 'UP' then N'UPDATE'
                                      when 'RF' then N'REFERENCES'
                                  end),
        IS_GRANTABLE    = convert(bit,case when p.state = 'G' then 0 else 1 end)
    from
        sys.columns c inner join -- All explicit permissions are only applicable to user objects only!
        sys.objects o on
            (
                o.object_id = c.object_id and
                o.type in ('U','V','S')
            ) inner join
        sys.database_permissions p on
            (
                p.major_id = o.object_id and
                p.major_id = c.object_id and
                (p.minor_id = 0 or p.minor_id = c.column_id) and
                p.class = 1 and
                p.state in ('G','W') and
                p.type in ('SL', 'IN', 'UP', 'RF')
            ) inner join
        sys.database_principals u on
            (
                u.principal_id = p.grantee_principal_id
            )
    where
        not exists (
                    select
                        major_id
                    from
                        sys.database_permissions p1
                    where
                        p1.major_id = p.major_id and
                        p1.minor_id = c.column_id and
                        p1.class = 1 and
                        p1.state in ('D', 'R') and
                        p1.type = p.type and
                        p1.grantee_principal_id = p.grantee_principal_id and
                        p1.grantor_principal_id = p.grantor_principal_id
                   )

 
Last revision 2008RTM
See also

  sp_column_privileges_rowset (Procedure)
sp_column_privileges_rowset2 (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