Date Checking

  • i am trying to creat a password policy that will also check the date that the password was created.  This will look into the sysxlogins table on the master db and get the creation date from there.  I know this is not an overly complex code setup but i dont work too well with DATEDIFF or any date coding .  I would like the sp or function to check to make sure the login created is not over 60 days old.  From that point i can modify to have it check and kick out messages when it gets closer to the 60 mark and expires.  Thanks for any help

    DHeath

  • i believe xdate1 is creation date, while xdate2 is last changed date?

    this would list all users that havne't changed their pass in >60 days i think. yould probalby use this as the basis of a sp or function.

    SELECT name ,DATEDIFF(day, xdate2, getdate()) AS no_of_days,* from sysxlogins where DATEDIFF(day, xdate2, getdate()) > 60

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • SELECT *,DATEDIFF(d,xdate1,GETDATE()) AS Days FROM sysxlogins WHERE xdate1 > DATEADD(d,-60,GETDATE())

    Should give the Logins created with in last 60 days

     

    Prasad Bhogadi
    www.inforaise.com

  • I believe I was typing when you posted it

     

    Prasad Bhogadi
    www.inforaise.com

  • Thanks a TON for the help..much appreciated...

    DHeath

Viewing 5 posts - 1 through 5 (of 5 total)

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