How to Check for Upcoming SQL Server Login (not Windows login) Password Expirations

  • SQL Server 2008 has an "Enforce password expiration" checkbox on the Login Properties window that will expire a login after x number of days. I don't see a "password last changed date" column in the sys.syslogins table.

    Can anyone tell me how SQL Server tracks the upcoming SQL Server login (not Windows login) password expirations?

    Ideally, I would like to write a query that would identify the logins that will expire 30 days from now so that we can take proactive measures to change the passwords without applications (like ColdFusion) having unexpected downtime due to expired passwords.

  • Does the following do what you're looking for?

    SELECT name, LOGINPROPERTY(name, 'DaysUntilExpiration') AS DaysUntilExpiration

    FROM sys.sql_logins

    WHERE LOGINPROPERTY(name, 'DaysUntilExpiration') <= 30

  • Deque (3/6/2013)


    Does the following do what you're looking for?

    SELECT name, LOGINPROPERTY(name, 'DaysUntilExpiration') AS DaysUntilExpiration

    FROM sys.sql_logins

    WHERE LOGINPROPERTY(name, 'DaysUntilExpiration') <= 30

    Yes, that's what I need. I was unaware of LOGINPROPERTY.

    Thank you.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply