sys.sql_logins


sys.sql_logins: Returns one row for each SQL Server authentication login. It will return all the below columns.

  • name
  • principal_id
  • sid
  • type
  • type_desc
  • is_disabled
  • create_date
  • modify_date
  • default_database_name
  • default_language_name
  • credential_id
  • is_policy_checked
  • is_expiration_checked
  • password_hash

You can query sys.sql_logins to get all the below information.

SQL Logins which are disabled:

SELECT name  
FROM [sys].[sql_logins] 
WHERE [is_disabled] = 1; 

SQL Server Logins which adhere the password policy:

SELECT name  
FROM [sys].[sql_logins] 
WHERE [is_policy_checked] = 1;

SQL Server Logins which do not adhere to the password policy

SELECT name  
FROM [sys].[sql_logins] 
WHERE [is_policy_checked] = 0;

SQL Logins which do not adhere to password expiration

SELECT name  
FROM [sys].[sql_logins] 
WHERE [is_policy_checked] = 0 
   OR  ([is_policy_checked] = 1 AND [is_expiration_checked] = 0);
Advertisements

One thought on “sys.sql_logins

Thanks for the comment, will get back to you soon... Jugal Shah

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s