DROP LOGIN command in SQL Server

The tutorial explains how to use the DROP LOGIN command in SQL Server with syntax and examples.

The DROP LOGIN command is used to delete an identity (which is the Login login account) used to connect to SQL Server.

Syntax of DROP command LOGIN

 DROP LOGIN ten_dangnhap; 

Variable name or variable value

Username

The login name of the login account (Login) needs to be deleted.

Note

  1. Cannot delete the login account currently logged into SQL Server.
  2. If you delete the login account that the database user has mapped to, the user will be disconnected to SQL Server.
  3. See also the CREATE LOGIN and ALTER LOGIN commands.

For example

 DROP LOGIN quantrimang; 

For example, the DROP LOGIN command above will delete the login account quatrimang. This command can only run if quantrimang is currently not logged in. Otherwise, this command will fail.

Previous lesson: ALTER LOGIN command in SQL Server

The following article: Find Login in SQL Server

4 ★ | 1 Vote