Allows a Microsoft® Windows NT® user or group account to connect to Microsoft SQL Server™ using Windows NT Authentication.
sp_grantlogin [@loginame =] 'login'
0 (success) or 1 (failure)
Use sp_grantlogin to reverse the effects of a previous sp_denylogin that has been executed for a Windows NT user.
Use sp_addlogin to allow a SQL Server login to connect to SQL Server.
Although a login can connect to SQL Server after sp_grantlogin has been executed, access to user databases is denied until a user account for the login is created in each database that the login must access. Use sp_grantdbaccess to create a user account in each user database.
sp_grantlogin cannot be executed within a user-defined transaction.
Only members of the sysadmin or securityadmin fixed server roles can execute sp_grantlogin.
This example allows the Windows NT user Corporate\BobJ to connect to SQL Server.
EXEC sp_grantlogin 'Corporate\BobJ'
Or
EXEC sp_grantlogin [Corporate\BobJ]
sp_addlogin | sp_revokelogin |
sp_denylogin | System Stored Procedures |