grant (core)

Assigns authorization to users.

Syntax

Transact-SQL Syntax

Grant authorization to access database objects:

grant {all [privileges] | permission_list}
 on {table_name [(column_list)]
 | view_name[(column_list)]
 | stored_procedure_name}
 to {public | name_list | role_name}
 [with grant option]

Grant authorization to create database objects:

grant {all [privileges] | command_list}
 to {public | name_list | role_name}

ODBC Syntax

GRANT {ALL|grant_privilege[,grant_privilege]...}
ON table_name
TO {PUBLIC|user_name[,user_name]...}
grant privilege::=
 DELETE
 | INSERT
 | SELECT
 | UPDATE[(column_identifier[,column_identifier]...)]
 | REFERENCES[(column_identifier[,column_identifier]
 ...)]

Parameters

Examples

Usage

  • Any valid object in the catalog can be substituted for table_name or view_name.

  • with grant optionis not available. Transformation removes this phrase.

  • ODBC does not allow you to grant authorization to a stored procedure.

  • You can substitute from for to in the grant syntax.

  • You can grant or revoke authorizations only on objects in the current database.