Disabling a login account
Posted by decipherinfosys on December 26, 2008
One of the readers had asked us recently about how he can disable the sysadmin account in SQL Server since he did not want anyone to use the “sa” login account. This team has over 20+ DBAs/DB Developers in the team and as per him, even in the application connection strings, the teams were using the “sa” login to make the connections.
One can easily disable any account in SQL Server 2005 and above by using the ALTER LOGIN command:
If you want to disable the “sa” login account, make sure that you are logged in using windows authentication and also make sure that you have other accounts set up with sysadmin privs as well.
ALTER LOGIN [sa] DISABLE;
will disable the login and replacing DISABLE with ENABLE and executing it will enable it. This can be done via the GUI as well. If you right click on the login in SSMS, select properties and go to the last page called “Status”, over here you will see the option of enabling/disabling the login as shown in the image below: