sp_table_privileges_ex

Transact-SQL Reference

Transact-SQL Reference

sp_table_privileges_ex

Returns privilege information about the specified table from the specified linked server.

Syntax

sp_table_privileges_ex [ @table_server = ] 'table_server'
    [ , [ @table_name = ] 'table_name' ]
    [ , [ @table_schema = ] 'table_schema' ]
    [ , [ @table_catalog = ] 'table_catalog' ]

Arguments

[@table_server =] 'table_server'

Is the name of the linked server for which to return information. table_server is sysname, with no default.

[@table_name =] 'table_name']

Is the name of the table for which to provide table privilege information. table_name is sysname, with a default of NULL.

[@table_schema =] 'table_schema'

Is the table schema, which in some DBMS environments is the table owner. table_schema is sysname, with a default of NULL.

[@table_catalog =] 'table_catalog'

Is the name of the database in which the specified table_name resides. table_catalog is sysname, with a default of NULL.

Return Code Values

None

Result Sets
Column name Data type Description
TABLE_CAT sysname Table qualifier name. Various DBMS products support three-part naming for tables (qualifier.owner.name). In SQL Server, this column represents the database name. In some products, it represents the server name of the table's database environment. This field can be NULL.
TABLE_SCHEM sysname Table owner name. In SQL Server, this column represents the name of the database user who created the table. This field always returns a value.
TABLE_NAME sysname Table name. This field always returns a value.
GRANTOR sysname Database username that has granted permissions on this TABLE_NAME to the listed GRANTEE. In SQL Server, this column is always the same as the TABLE_OWNER. This field always returns a value. Also, the GRANTOR column may be either the database owner (TABLE_OWNER) or a user to whom the database owner granted permission by using the WITH GRANT OPTION clause in the GRANT statement.
GRANTEE sysname Database username that has been granted permissions on this TABLE_NAME by the listed GRANTOR. This field always returns a value.
PRIVILEGE varchar(32) One of the available table permissions. Table permissions can be one of the following values (or other values supported by the data source when implementation is defined):
SELECT = GRANTEE can retrieve data for one or more of the columns.
INSERT = GRANTEE can provide data for new rows for one or more of the columns.
UPDATE = GRANTEE can modify existing data for one or more of the columns.
DELETE = GRANTEE can remove rows from the table.
REFERENCES = GRANTEE can reference a column in a foreign table in a primary key/foreign key relationship. In SQL Server, primary key/foreign key relationships are defined with table constraints.

The scope of action given to the GRANTEE by a given table privilege is data source-dependent. For example, the UPDATE privilege may permit the GRANTEE to update all columns in a table on one data source and only those columns for which the GRANTOR has UPDATE privilege on another data source.

IS_GRANTABLE varchar(3) Indicates whether or not the GRANTEE is permitted to grant permissions to other users (often referred to as "grant with grant" permission). Can be YES, NO, or NULL. An unknown (or NULL) value refers to a data source in which "grant with grant" is not applicable.

Remarks

The results returned are ordered by TABLE_QUALIFIER, TABLE_OWNER, TABLE_NAME, and PRIVILEGE.

Permissions

Execute permission default to public role.

Examples

This example returns privilege information about the Customers table, owned by the dbo, in the Northwind database from the specified linked server (SQL Server is assumed as the linked server).

EXEC sp_table_privileges_ex London1, Customers, dbo, Northwind

See Also

sp_column_privileges_ex