sp_column_privileges

Description

Returns permissions information for one or more columns in a table or view.

Syntax

sp_column_privileges table_name [, table_owner
	[, table_qualifier [, column_name]]]

Parameters

table_name

is the name of the table. The use of wildcard characters in pattern matching is not supported.

table_owner

is the name of the table owner. The use of wildcard characters in pattern matching is not supported. If you do not specify the table’s owner, sp_column_privileges looks for a table owned by the current user and then for a table owned by the Database Owner.

table_qualifier

is the name of the database. Values are the name of the current database and null.

column_name

is the name of the column whose permissions you want to display. Use wildcard characters to request information for more than one column. If you do not specify a column name, permissions information for all columns in the specified table is returned.

Examples

Example 1

sp_column_privileges discounts, null, null, discounttype
table_qualifier     table_owner    table_name          column_name 
     grantor   grantee     privilege     is_grantable 
------------------- -------------- ------------------- ----------------
     --------- ----------- ------------- ------------ 
pubs2               dbo            discounts           discounttype 
     dbo       dbo          SELECT       YES 
pubs2               dbo            discounts           discounttype 
     dbo       dbo          UPDATE       YES 
pubs2               dbo            discounts           discounttype 
     dbo       dbo          REFERENCE   YES 
pubs2               dbo            discounts           discounttype 
     dbo       guest       SELECT        NO 
pubs2               dbo            discounts           discounttype 
     dbo       guest       UPDATE        NO 
pubs2               dbo            discounts           discounttype 
     dbo       guest       REFERENCE     NO

Usage

Permissions

Any user can execute sp_column_privileges.