Skip to main content

CREATE USER (bSQL) | Blockpoint Docs

Creates a user for the defined database. For examples, see Examples.

bSQL Syntax Conventions

Syntax

CREATE USER user_name FOR LOGIN login_name;

Arguments

user_name
Specifies the name of the user to be created.

login_name
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.

Permissions

Requires AUTH permission on the current database, ownership of the database, or membership of admin fixed database role.

Remarks

  • 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.
  • The CREATE USER command can only be run when connected to a user defined database.

Examples

Creating a datbase user using a login.

The following example first creates a new login and then creates a corresponding database user in the financial database.

CREATE LOGIN AbolrousHazem  WITH PASSWORD = "340$Uuxwp7Mcxo7Khy";
USE financial;
CREATE USER AbolrousHazem FOR LOGIN AbolrousHazem;

See Also