How can I use TSQL to check when a user's password will expire?

ε祈祈猫儿з 提交于 2019-12-07 22:28:19

问题


With SQL Server 2005 and above, how can I check when a user's password is going to expire using TSQL?

Preferably this would be done using a connection for that same user. What permissions would be required for the SQL statement to be run?


回答1:


In SQL Server 2008, you can use SELECT LOGINPROPERTY('sa', 'DaysUntilExpiration').

For more accurate data - and also in SQL Server 2005, where DaysUntilExpiration is not supported, a combination of SELECT LOGINPROPERTY('sa', 'PasswordLastSetTime') and the password expiry policy out of Group Policy would do it.

According to SQL Server help, this function 'Requires VIEW permission on the login'.



来源:https://stackoverflow.com/questions/675395/how-can-i-use-tsql-to-check-when-a-users-password-will-expire

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!