Click to Rate and Give Feedback
TechNet
TechNet Library
SQL Server
SQL Server 2008 R2
Database Engine
 How to: Create a SQL Server Login
Community Content
In this section
Statistics Annotations (5)
Collapse All/Expand All Collapse All
Other versions are also available for the following:
How to: Create a SQL Server Login

Most Windows users need a SQL Server login to connect to SQL Server. This topic shows how to create a SQL Server login.

To create a SQL Server login that uses Windows Authentication (SQL Server Management Studio)

  1. In SQL Server Management Studio, open Object Explorer and expand the folder of the server instance in which to create the new login.

  2. Right-click the Security folder, point to New, and then click Login.

  3. On the General page, enter the name of a Windows user in the Login name box.

  4. Select Windows Authentication.

  5. Click OK.

To create a SQL Server login that uses SQL Server Authentication (SQL Server Management Studio)

  1. In SQL Server Management Studio, open Object Explorer and expand the folder of the server instance in which to create the new login.

  2. Right-click the Security folder, point to New, and then click Login.

  3. On the General page, enter a name for the new login in the Login name box.

  4. Select SQL Server Authentication. Windows Authentication is the more secure option.

  5. Enter a password for the login.

  6. Select the password policy options that should be applied to the new login. In general, enforcing password policy is the more secure option.

  7. Click OK.

To create a SQL Server login that uses Windows Authentication using Transact-SQL

  • In Query Editor, enter the following Transact-SQL command: CREATE LOGIN <name of Windows User> FROM WINDOWS; GO     

To create a SQL Server login that uses SQL Server Authentication (Transact-SQL)

  • In Query Editor, enter the following Transact-SQL command: CREATE LOGIN <login name> WITH PASSWORD = '<password>' ; GO    

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Doesn't work with SQLExpress SQLCMD utility      FrankBovinCantPossiblyBeInUse ... Thomas Lee   |   Edit   |   Show History
It balks at the "\" in the DOMAIN\USER specification, no amount of escaping (DOM\NAM, DOM\\NAM, N'DOM\NAM', "DOM\NAM") will work


[tfl - 06 01 12] Hi - and thanks for your post. Community content is not the appropriate place for technical support queries. Instead,
you should visit the MSDN Forums at http://forums.microsoft.com/MSDN, where such posts are welcomed and where you stand a much
better chance of getting your query resolved. Sorry if that's not the answer you wanted to hear.

Tags What's this?: Add a tag
Flag as ContentBug
Adding Domain Users      Gerardo Saca   |   Edit   |   Show History
What worked for me was:

CREATE LOGIN [DOMAIN\username] FROM Windows
Tags What's this?: Add a tag
Flag as ContentBug
Working with SQL Server Login      Mohammad Elsheimy   |   Edit   |   Show History
Tags What's this?: Add a tag
Flag as ContentBug
Adding Domain Users      Adam Ogle   |   Edit   |   Show History
If you want to add a user that is part of a domain, wrap the DOMAIN\USER combo in double-quotes: 

create login "DOMAIN\USER" from windows; go

Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2012 Microsoft. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker