This SQL Server tutorial explains how to use the SQL Server DROP LOGIN statement with syntax and examples.
The DROP LOGIN statements is used to remove an identity (ie: Login) used to connect to a SQL Server instance.
The syntax for the DROP LOGIN statements in SQL Server (Transact-SQL) is:
DROP LOGIN login_name;
Parameters or Arguments
user_nameThe name of the Login to remove.
- You can not drop a Login when it is currently logged into SQL Server.
- If you drop a Login that has database users mapped to it, the users will be orphaned in SQL Server.
- See also the CREATE LOGIN statement and the ALTER LOGIN statement.
Let’s look at an example that shows how to use the DROP LOGIN statements in SQL Server (Transact_SQL).
DROP LOGIN adglob;
This DROP LOGIN example would drop the Login called adglob. This DROP LOGIN statement will only run if adglob is not currently logged in. If adglob is currently logged into SQL Server, the DROP LOGIN statements will raise an error.