Creates a user for the defined database. For examples, see Examples.
CREATE USER user_name FOR LOGIN login_name;
Specifies the name of the user to be created.
Specifies the login that maps to the database user. When this MDB login enters the database, it acquires the name and ID of the database user that is being created.
AUTH permission on the current database, ownership of the database, or membership of admin fixed database role.
- MDB users are database principals for user-defined databases.
- When using a user-defined database, permissions and encryption keys are relative to the database user, not the login used to establish the connection to MDB.
CREATE USERcommand can only be run when connected to a user defined database.
Creating a datbase user using a login.
The following example first creates a new login and then creates a corresponding database user in the
CREATE LOGIN AbolrousHazem WITH PASSWORD = "340$Uuxwp7Mcxo7Khy";
CREATE USER AbolrousHazem FOR LOGIN AbolrousHazem;