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

  • GOTO command in SQL ServerGOTO command in SQL Server
    the goto command is a simple jump command, which allows an unconditional jump program from goto to a location in the program that has a label (laber) command in the same function.
  • Clean command in WindowsClean command in Windows
    the clean command deletes all partitions or formats the volume from the current drive. the command applies to windows server (semi-annual channel), windows server 2019, windows server 2016, windows server 2012 r2, windows server 2012.
  • Find User in SQL ServerFind User in SQL Server
    do any queries on sql server return all user created?
  • CASE function in SQL Server (part 1)CASE function in SQL Server (part 1)
    in sql server, the case function verifies the value based on the list of given conditions, then returns one or more results. in this article we will illustrate a number of different uses of this function in different situations.
  • Transfer from Linux Mail Server to Exchange Server 2007 (Part 3)Transfer from Linux Mail Server to Exchange Server 2007 (Part 3)
    through the previous two sections we have created users, this article will switch to the user information section. using the new-mailbox command cannot add the information we have in the csv file.
  • The sfc command in WindowsThe sfc command in Windows
    (applies to windows server (semi-annual channel), windows server 2016, windows server 2012 r2, windows server 2012)
  • The cacls command in WindowsThe cacls command in Windows
    the cacls command displays or modifies an arbitrary access control list (dacl) on the specified file. the command applies to windows server (semi-annual channel), windows server 2016, windows server 2012 r2, windows server 2012.
  • CASE statement in SQL ServerCASE statement in SQL Server
    this article will show you in detail how to use the case statement handling function in sql server with specific syntax and examples to better visualize and capture functions.
  • SEQUENCE in SQL ServerSEQUENCE 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.
  • SELECT TOP command in SQL ServerSELECT TOP command in SQL Server
    in sql server, the select top command is used to retrieve records from one or more tables in sql server and limit the number of return records based on a fixed value or percentage.