Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



INFORMATION_SCHEMA.TABLE_PRIVILEGES

  No additional text.


Syntax
CREATE VIEW INFORMATION_SCHEMA.TABLE_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,
	convert(varchar(10), CASE p.type
		WHEN 'RF' THEN 'REFERENCES'
		WHEN 'SL' THEN 'SELECT'
		WHEN 'IN' THEN 'INSERT'
		WHEN 'DL' THEN 'DELETE'
		WHEN 'UP' THEN 'UPDATE'
		END)						AS PRIVILEGE_TYPE,
	convert(varchar(3), CASE p.state
		WHEN 'G' THEN 'NO'
		WHEN 'W' THEN 'YES'
		END)						AS IS_GRANTABLE
FROM
	sys.objects o,
	sys.database_permissions p
WHERE
	o.type IN ('U', 'V')
	AND p.class = 1
	AND p.major_id = o.object_id
	AND p.minor_id = 0	-- all columns
 	AND p.type IN ('RF','IN','SL','UP','DL')
 	AND p.state IN ('W','G')
	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_table_privileges_view (View)
sp_ddopen (Procedure)
sp_table_privileges (Procedure)
sp_table_privileges_ex (Procedure)
sp_table_privileges_rowset (Procedure)
sp_table_privileges_rowset2 (Procedure)
sp_table_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