Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



INFORMATION_SCHEMA.COLUMN_PRIVILEGES

  No additional text.


Syntax
CREATE VIEW INFORMATION_SCHEMA.COLUMN_PRIVILEGES
AS
SELECT
	USER_NAME(p.grantor_principal_id)	AS GRANTOR,
	USER_NAME(p.grantee_principal_id)	AS GRANTEE,
	DB_NAME()						AS TABLE_CATALOG,
	SCHEMA_NAME(o.schema_id)			AS TABLE_SCHEMA,
	o.name							AS TABLE_NAME,
	c.name							AS COLUMN_NAME,
	convert(varchar(10), CASE p.type
		WHEN 'SL' THEN 'SELECT'
		WHEN 'UP' THEN 'UPDATE'
		WHEN 'RF' THEN 'REFERENCES'
		END)						AS PRIVILEGE_TYPE,
	convert(varchar(3), CASE p.state
		WHEN 'G' THEN 'NO'
		WHEN 'W' THEN 'YES'
		END)						AS IS_GRANTABLE
FROM
    sys.database_permissions p,
    sys.objects o,
    sys.columns c
WHERE
    o.type IN ('U', 'V')
    AND o.object_id = c.object_id
    AND p.class = 1
    AND p.major_id = o.object_id
    AND p.minor_id = c.column_id
    AND p.type IN ('RF','SL','UP')
    AND p.state IN ('G', 'W')
    AND (p.grantee_principal_id = 0
    	OR p.grantee_principal_id = DATABASE_PRINCIPAL_ID()
    	OR p.grantor_principal_id = DATABASE_PRINCIPAL_ID())

 
Last revision 2008RTM
See also

  spt_column_privileges_owner_view (View)
spt_column_privileges_set_view (View)
sp_column_privileges (Procedure)
sp_column_privileges_ex (Procedure)
sp_column_privileges_rowset (Procedure)
sp_column_privileges_rowset2 (Procedure)
sp_column_privileges_rowset_rmt (Procedure)
sp_ddopen (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