In SQL Server we can enable or disable Logins through SSMS GUI and also from SQL Commands using ALTER LOGIN command. Today I will show how to enable or disable the Logins through query.
I have created a demo Login called [sam].
Lets first ENABLE the Login:
ALTER LOGIN sam ENABLE
Now to DISABLE the Login:
ALTER LOGIN sam DISABLE
We can also change the name of any Login ID. I prefer this option to always change the name of ‘sa’ account.
To rename the Login ID, use the following command:
ALTER LOGIN sam WITH NAME=[Samuel]