How to find last login date of a sql login? RRS feed

  • Question

  • i want to disable the SQL Logins which are not logged in last 15 days. (I schedule a job every night to check and disable)

    For this 

    i want to find  last login date of all sql logins in an instance if the login didn't log in with in 15 days i want to disable them.

    In SYS.SYSLOGINS table we can see all the logins and 'isntname' tells us if it is SQL login or windows login. 

    but where to find the last login date of SQL log in ?

    Can any one help me?



    Tuesday, August 30, 2011 7:49 PM


  • Hi There


    I have checked the related system tables and I cannot find the past logon date and you even need for 15 days..

    I think it is better you  can implement a logon trigger as described in the below MSDN article

    instead of reverting the back the logons, just store the data in the master or some other database in a table... and then compare it at the end of the 15 days...


    One of the solutions... If some one else finds the place where the actual logon date is logged then it is much better.


    Nothing is Permanent... even Knowledge....
    My Blog
    • Proposed as answer by Peja Tao Thursday, September 1, 2011 6:21 AM
    • Marked as answer by KJian_ Wednesday, September 7, 2011 6:53 AM
    Tuesday, August 30, 2011 8:01 PM

All replies