Deleting an Existing Login in SQL Server 2008
In this article I will explain how to delete existing login account in SQL Server through different methods.
Login is used for security purpose. Users need login to access SQL Server. Login can be created based on windows principal such as SQL Server Authentication or Windows authentication. Login must be mapped to a database user to connect to a particular database. There are 3 ways to remove a SQL Server login account.
- Using SQL Server Management Studio.
- Using SQL query.
- Using system stored procedure
Deleting a Login using SQL Server Management Studio
Open SQL Server Management Studio and connect to database engine.
In object explorer step down to the Security object node. Right-click on login name which you want to delete. Select delete to delete the login.
Refresh the login node and see, selected node is deleted.
Deleting a Login using SQL Statement
To drop a login from SQL Server via SQL statement, use following syntax:
where login_name specifies the existing login name which you want to delete.
Suppose you want to delete login named "NEW LOGIN".
drop login [NEW_LOGIN];
Refresh login node.
Deleting a Login using Stored Procedure
where user specifies the login name which you want to delete.
EXEC sp_droplogin 'LOGIN'
Refresh login node. LOGIN user has been deleted.