Help needed to write SQL Query for SQL Logins
I need to write SQL Query to Retrive the Following Settings of SQL Logins for SQL server 2005:
开发者_JS百科1.Enforce password policy
2.Enforce password expiration
3.User must change password at next login
Thanx in advance.
SELECT *
FROM sys.sql_logins
should give you the first two (is_policy_checked and is_expiration_checked columns)
and you can use SELECT LOGINPROPERTY('sa', 'IsMustChange')
to find if the user must change password at next login
So putting it all into one query...
SELECT name,
is_policy_checked,
is_expiration_checked,
LOGINPROPERTY(name, 'IsMustChange') as is_must_change
FROM sys.sql_logins
精彩评论