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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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’.