SQL Server: CREATE LOGIN Statement - TechOnTheNet

Syntax

The syntax for the CREATE LOGIN statement using Windows Authentication is:

CREATE LOGIN [domain_name\login_name] FROM WINDOWS [ WITH DEFAULT_DATABASE = database_name | DEFAULT_LANGUAGE = language_name ];

OR

The syntax for the CREATE LOGIN statement using SQL Server Authentication is:

CREATE LOGIN login_name WITH PASSWORD = { 'password' | hashed_password HASHED } [ MUST_CHANGE ] [ , SID = sid_value | DEFAULT_DATABASE = database_name | DEFAULT_LANGUAGE = language_name | CHECK_EXPIRATION = { ON | OFF } | CHECK_POLICY = { ON | OFF } | CREDENTIAL = credential_name ];

OR

The syntax for the CREATE LOGIN statement using a certificate is:

CREATE LOGIN login_name FROM CERTIFICATE certificate_name;

OR

The syntax for the CREATE LOGIN statement using an asymmetric key is:

CREATE LOGIN login_name FROM ASYMMETRIC KEY asym_key_name;

Parameters or Arguments

domain_name The name of the Windows domain account. login_name The name of the Login. database_name The default database to assign to the Login. language_name The default language to assign to the Login. CHECK_EXPIRATION By default, it set to OFF. This option determines whether password expiration policy is enforced. You must specifiy CHECK_EXPIRATION = ON when you use the MUST_CHANGE option. password The password to assign to the Login. hashed_password The hashed value of the password to assign to the Login. MUST_CHANGE It is used when you want to force the password to be changed the first time that the Login is used. sid_value The GUID of the login. If this parameter is omitted, SQL Server will assign a GUID to the Login. credential_name The name of a credential to assign to the Login. certificate_name The name of the certificate to assign to the Login. asym_key_name The name of an asymmetric key to assign to the Login.

Từ khóa » đăng Nhập Sql Server