The CREATE USER command in SQL Server
This article will show you in detail how to use the CREATE USER command in SQL Server, with specific syntax and examples to better visualize and capture commands.
Describe the CREATE USER command in SQL Server
CREATE USER creates the user database to log into SQL Server. A user database will be mapped to the Login, identifier used to connect to a specific SQL Server instance.
The syntax of CREATE USER command in SQL Server
The CREATE USER command has the following syntax:
CREATE USER user_name FOR LOGIN login_name;
Parameters:
- user_name: The name of the database user you want to create.
- login_name: The Login name is used to connect to a specific SQL Server.
Note:
- Before creating a database user, make sure you have created the Login before.
- You can only map a Login to a user in each database in SQL Server, but you can also map Login to different user names for each database as long as it is a 1: 1 relationship of Login with a single database.
Example of CREATE USER command in SQL Server
Suppose you want to create a database user named quantrimangcom in SQL Server, and use the previously created Login named qtm as an identifier to connect to a specific SQL Server, we will use the CREATE USER command as follows:
CREATE USER quantrimangcom FOR LOGIN qtm;
In the next article we will learn how to change the password in SQL Server.
Previous article: Find Login in SQL Server
Next lesson: Change the password in SQL Server
You should read it
- DROP USER command in SQL Server
- How to create users in MS SQL Server
- USER_NAME function in SQL Server
- SYSTEM_USER function in SQL Server
- Function SESSION_USER in SQL Server
- CURRENT_USER statement in SQL Server
- How to create a database in MS SQL Server
- How to decentralize users in MS SQL Server
- Find User in SQL Server
- Use the ALTER DATABASE command to migrate DATABASE in SQL Server
- The command changes user in Windows
- Create a new local user account in Windows Server 2016
Maybe you are interested
US users can now access ChatGPT via 1-800-CHATGPT
How to Change the Default User Account Avatar in Windows
2 features users don't like in Photoshop Express photo editing application
Microsoft still recommends 15-year-old backup solution for Windows 11 and 10 users
Canonical Urges Ubuntu 20.04 LTS Users to Upgrade or Purchase Extended Support
Microsoft removes a barrier preventing users from updating to Windows 11 24H2