Grabbing Network Login

  • I have an application that logs into SQL Server 2005 using SQL Server credentials. So the users log into their own machines using Windows Authentication. I am trying to get a trigger going where it will not only grab the SQL Server login (which I have using the User function) but I also want to grab the windows authentication login. I do not know where I can grab this information we are using SQL Server credentials. I am also grabbing the workstation that the user is using - I'm grabbing all of this info as a user could be logged into their PC but step away and someone else could use their PC and login to the application and I want to find out who does this and when.

    I do see that ADVAPI32.dll has a function in there named uf_get_logon_name that would grab this info but I have no idea how to use a DLL within a T-SQL Trigger.

    If anyone can show me how to grab the network windows authentication login in SQL Server using T-SQL, I would extremely happy to hear from you.

  • select spid,nt_username from master..sysprocesses

    or

    select system_user

    Prakash Heda
    Lead DBA Team - www.sqlfeatures.com
    Video sessions on Performance Tuning and SQL 2012 HA

  • Thanks so much the system_user worked perfect.

    By any chance do you know how to grab the driver that is used to connect to the SQL Server database using T-SQL - one other request by the director of the department.

    Thanks,

    Jon

  • serach this table....its right there....master..sysprocesses

    Prakash Heda
    Lead DBA Team - www.sqlfeatures.com
    Video sessions on Performance Tuning and SQL 2012 HA

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

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