xp_grantlogin Extended Stored Procedure

Grants SQL Server access to a Windows NT - based group or user.

Syntax

xp_grantlogin 'account_name' [, {'admin' | 'repl' | 'user'}]

where

account_name
Specifies the Windows NT - based group or user. The group or user must already be defined in Windows NT. If the group or username does not include a domain name and a backslash (\), Windows NT initially searches for a matching user on the local computer, then on the primary domain controller, and then on trusted domains.
admin
Gives account_name system administrator privilege.
repl
Gives account_name privilege to log on as repl_publisher.
user
Explicitly gives account_name user privilege. If no parameter is specified, user privilege is granted.

Remarks

You can change accounts from one privilege level to another by executing xp_grantlogin.

Example

This example grants SQL Server access to the sqladmins group and gives the group system administrator privilege.

xp_grantlogin 'sqladmins', 'admin'

Permission

Execute permission defaults to the system administrator and can be granted to other users.

See Also

xp_enumgroups xp_logininfo
xp_loginconfig xp_revokelogin