HOW TO CHECK IF A USER ACCOUNT IS LOCKED? IF LOCKED HOW TO UNLOCK IT?
There are times a DBA gets a request to see the user account got locked or the user is unable to login.
Here is the simple script to see if a login account is locked or not.
Use Master
Go
select loginproperty('UserName','Islocked')
GO
|
If the script above returns
1- Account got Locked
0- Not Locked
If Retuns 1 and need to Unlock the account Run the below script.
ALTER LOGIN [UserName] WITHPASSWORD='****'UNLOCK;
GO
|