Does anyone know how use someone's NT Logon status and put it into a variable that could be run in a SQL query?

Thanks