client username - sql authentication

  • HI

    I have an client app which connects to SQL server Server via SQL Authentication. This Client app is developed by a third party and so we dont have the code. Now i have a trigger on a table which writes changes to another table - this is for auditing purposes. Now i need to know who made the change from the client app.

    But if i use any of the SQL functions(SUSER-SNAME(), SYSTEM_USER, CURRENT_USER, USER() etc etc) it gives me NT AUTHORITY\SYSTEM. If i use HOST_NAME() then it gives me the name of the server and not the client.

    How would i get the name of the person logged into the client machine? or even the name of the client machine? any suggestions?

    Does anybody know how the table sysprocesses gets populated or which Stored procedure is used to populate it?

    All help will be appreciated

    Regards,

    Scholes

  • This was removed by the editor as SPAM

  • Have you tried user_name(user_id()) ?  This works for me.  When logged in using SQL Server authentication, this returns my SQL Server user login name. 

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • How do you know the app is using SQL Authentication?

  • Hi

    if i delete BUILTIN\ADMINISTRATORS then the app does does not work. It gives an error. So what does this mean??? will i ever be able to get the username???? any workarounds?

    user_name(user_id())  returns dbo as the username.

    regards

    Scholes

  • You may want to try to look through sp_who and sp_who2.  I think there is plenty of logic built into those guys that you could strip out and use to meet your needs.  Good Luck!

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • If you delete BUILTIN/Administatrator login and the app failed, then that is an indication that the application uses Windows Authentication and is using a login that has local (or network) administrator rights.

    -SQLBill

Viewing 7 posts - 1 through 6 (of 6 total)

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