sp_grantlogin (Transact-SQL)
Applies to: SQL Server
Creates a SQL Server login.
Important
This feature will be removed in a future version of SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Use CREATE LOGIN instead.
Transact-SQL syntax conventions
Syntax
sp_grantlogin [@loginame=] 'login'
Arguments
[ @loginame = ] 'login'
Is the name of a Windows user or group. The Windows user or group must be qualified with a Windows domain name in the form Domain\User; for example, London\Joeb. login is sysname, with no default.
Return Code Values
0 (success) or 1 (failure)
Remarks
sp_grantlogin calls CREATE LOGIN, which supports additional options. For information on creating SQL Server logins, see CREATE LOGIN (Transact-SQL)
sp_grantlogin cannot be executed within a user-defined transaction.
Permissions
Requires membership of server role securityadmin.
Examples
The following example uses CREATE LOGIN
to create a SQL Server login for the Windows user Corporate\BobJ.
This is the preferred method.
CREATE LOGIN [Corporate\BobJ] FROM WINDOWS;
GO
See Also
Security Stored Procedures (Transact-SQL)
CREATE LOGIN (Transact-SQL)
System Stored Procedures (Transact-SQL)
Σχόλια
https://aka.ms/ContentUserFeedback.
Σύντομα διαθέσιμα: Καθ' όλη τη διάρκεια του 2024 θα καταργήσουμε σταδιακά τα ζητήματα GitHub ως μηχανισμό ανάδρασης για το περιεχόμενο και θα το αντικαταστήσουμε με ένα νέο σύστημα ανάδρασης. Για περισσότερες πληροφορίες, ανατρέξτε στο θέμα:Υποβολή και προβολή σχολίων για