Courion Tip – SSIS Active Directory and LastLogonTimeStamp

Very briefly, the last logon time stamp is something like the number of milliseconds since Jan 1, 1601 (something to do with the Year 2000 Bug and that was ANSI’s solution to it)

So, to get the last logon date (I didn’t bother with the hours minutes and seconds)

I pull in the lastlogondatestamp as a string and then do this:

UPDATE    dbo.STAGING_AD
SET              lastLogon = DATEADD([Day], CAST(LastLogonTimeStamp AS numeric) / 864000000000 – 109207, 01 / 01 / 1601)

Advertisements

Posted June 6, 2011 by mmdmurphy in Courion Tip

Tagged with , ,

%d bloggers like this: