开发者

Help needed to write SQL Query for SQL Logins

开发者 https://www.devze.com 2023-01-07 06:35 出处:网络
I need to write SQL Query to Retrive the Following Settings of SQL Logins for SQL server 2005: 1.Enforce password policy

I need to write SQL Query to Retrive the Following Settings of SQL Logins for SQL server 2005:

1.Enforce password policy

2.Enforce password expiration

3.User must change password at next login

开发者_JS百科

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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号