Export (0) Print
Expand All

GRANT Server Principal Permissions (Transact-SQL)

Grants permissions on a SQL Server login.

Topic link icon Transact-SQL Syntax Conventions


GRANT permission [ ,...n ] } 
    ON LOGIN :: SQL_Server_login
        TO <server_principal> [ ,...n ]
    [ WITH GRANT OPTION ]
    [ AS SQL_Server_login ] 

<server_principal> ::= 
        SQL_Server_login
    | SQL_Server_login_from_Windows_login 
    | SQL_Server_login_from_certificate 
    | SQL_Server_login_from_AsymKey

permission

Specifies a permission that can be granted on a SQL Server login. For a list of the permissions, see the Remarks section later in this topic.

LOGIN :: SQL_Server_login

Specifies the SQL Server login on which the permission is being granted. The scope qualifier (::) is required.

TO <server_principal>

Specifies the SQL Server login to which the permission is being granted.

SQL_Server_login

Specifies the name of a SQL Server login.

SQL_Server_login_from_Windows_login

Specifies the name of a SQL Server login created from a Windows login.

SQL_Server_login_from_certificate

Specifies the name of a SQL Server login mapped to a certificate.

SQL_Server_login_from_AsymKey

Specifies the name of a SQL Server login mapped to an asymmetric key.

WITH GRANT OPTION

Indicates that the principal will also be given the ability to grant the specified permission to other principals.

AS SQL_Server_login

Specifies the SQL Server login from which the principal executing this query derives its right to grant the permission.

Permissions at the server scope can be granted only when the current database is master.

Information about server permissions is visible in the sys.server_permissions catalog view. Information about server principals is visible in the sys.server_principals catalog view.

A SQL Server login is a server-level securable. The most specific and limited permissions that can be granted on a SQL Server login are listed in the following table, together with the more general permissions that include them by implication.

SQL Server login permission Implied by SQL Server login permission Implied by server permission

CONTROL

CONTROL

CONTROL SERVER

IMPERSONATE

CONTROL

CONTROL SERVER

VIEW DEFINITION

CONTROL

VIEW ANY DEFINITION

ALTER

CONTROL

ALTER ANY LOGIN

Requires CONTROL permission on the login or ALTER ANY LOGIN permission on the server.

A. Granting IMPERSONATE permission on a login

The following example grants IMPERSONATE permission on the SQL Server login WanidaBenshoof to a SQL Server login created from the Windows user AdvWorks\YoonM.

USE master;
GRANT IMPERSONATE ON LOGIN::WanidaBenshoof to [AdvWorks\YoonM];
GO

B. Granting VIEW DEFINITION permission with GRANT OPTION

The following example grants VIEW DEFINITION on the SQL Server login EricKurjan to the SQL Server login RMeyyappan with GRANT OPTION.

USE master;
GRANT VIEW DEFINITION ON LOGIN::EricKurjan TO RMeyyappan 
    WITH GRANT OPTION;
GO 

Community Additions

ADD
Show:
© 2014 Microsoft