Description:
Creates a login account for the connection to the SQL Server instance with using the SQL Server authentication.
Syntax:
sp_addlogin
[
@loginame =] 'login'
[, [
@passwd =] 'password']
[, [
@defdb =] 'database']
[, [
@deflanguage =] 'language']
[, [
@sid = ] sid]
[, [
@encryptopt =] 'encryption_option']
@loginame |
Name of the login account. |
@passwd |
Password of the account (NULL means without a password, the default value is NULL). |
@defdb |
Default database of the account (the default value is 'master'). |
@deflanguage |
Default language of the account (the default value is NULL). |
@sid |
Security identification number (the default value is NULL and the system generates the SID automatically). |
@encryptopt |
Specifies whether the password is stored in the system tables encrypted (the default value is NULL and the password is encrypted). |
Example:
Adds the account 'pm_reader' with the password 'reader' and the default database 'pm_data'.
EXEC sp_addlogin 'pm_reader', 'reader', 'pm_data'