How to List all Locked SQL Logins in SQL Server

To list all locked SQL logins in SQL Server, use the following query:

SELECT name, is_disabled, LOGINPROPERTY(name, N'isLocked') as is_locked
FROM sys.sql_logins
WHERE LOGINPROPERTY(name, N'isLocked') = 1
ORDER BY name;

locked_logins_list

To list all locked SQL logins in SQL Server, including the time when the login was locked out, use the following query:

SELECT name, is_disabled, LOGINPROPERTY(name, N'isLocked') as is_locked,
LOGINPROPERTY(name, N'LockoutTime') as LockoutTime
FROM sys.sql_logins
WHERE LOGINPROPERTY(name, N'isLocked') = 1
ORDER BY name;

locked_logins_list_lockout_time

To see how to unlock SQL login without changing the login password, read related blog post:

Unlock login without changing the password in SQL Server