This topic describes how to use SQL statements to create and manage users in ApsaraDB RDS SQL Server databases.

Note You can create users only in your databases, but not in system databases.

Prerequisites

  • The instance version must be ApsaraDB RDS SQL Server 2012 or later.
  • A database is created. For more information about the statements to create a database, see Manage databases with SQL statements.
  • A login is created and logged on to the database where you need to create a user. For more information about the statements to create a login, see Manage ApsaraDB RDS SQL Server logins.

Create a user

You can execute the following statements to create a user in the TestDB database:

USE TestDB
GO
CREATE USER [Test] FOR LOGIN [Test]

Modify the user information

You can modify user information by executing the following statements. It is the same as in SQL Server.

USE TestDB
GO
ALTER USER test WITH LOGIN=test

Delete a user

You can delete a user by executing the following statements. It is the same as in SQL Server.

USE TestDB
GO
DROP USER test