DROP USER command in SQL Server

This article will show you in detail how to use the DROP USER command in SQL Server with specific syntax and examples to better visualize and capture commands.

DROP USER command description in SQL Server

DROP USER is used to remove a user from a SQL Server database.

Syntax of the DROP USER command in SQL Server

The DROP USER command has the following syntax:

 DROP USER user_name; 

Parameters:

  1. user_name: The user name you want to delete from the SQL Server database

Note:

  1. Before you want to remove a user, you need to make sure that you delete all the objects of that user or transfer the object handling to another account if needed.

Example of a DROP USER command in SQL Server

Suppose you want to delete a database user named quantrimang in SQL Server. The DROP USER command will only run when quantrimang no longer has any objects in the database. Then we use the following command:

 DROP USER quantrimang; 

See more:

  1. VIEW in SQL Server
  2. JOIN in SQL Server

Previous article: Change user password, login in SQL Server

Next article: Find User in SQL Server

5 ★ | 1 Vote

May be interested

  • Find User in SQL ServerPhoto of Find User in SQL Server
    do any queries on sql server return all user created?
  • Use annotations in SQL ServerPhoto of Use annotations in SQL Server
    this article will show you how to use annotations in sql server statements.
  • LITERAL in SQL ServerPhoto of LITERAL in SQL Server
    the article details how to use literal - hang (strings, integers, decimals, and datetime values) in sql server.
  • Declare variables in SQL ServerPhoto of Declare variables in SQL Server
    sql server fully exists the concepts of data types, variables and declarations of variables as other programming languages. the article will learn how to declare a variable, multiple variables and assign default values ​​to variables in sql server.
  • SEQUENCE in SQL ServerPhoto of SEQUENCE in SQL Server
    sequence is often used in databases because it is necessary for many applications. the article will provide syntax and examples of how to create and delete the sequence and its attributes in sql server.
  • FUNCTION (Function) in SQL ServerPhoto of FUNCTION (Function) in SQL Server
    the function in sql server is stored in the database so you can pass the parameters as well as return the values. the article will give you the syntax and examples of how to create and delete functions in sql server.