Get Network user id for MS Sql Server 2000 in table trigger on insert/update

  • What is the code required to Get the actual Network user id for MS Sql Server 2000 in table trigger on insert/update?

    The windows application has its own built-in security, so it uses the granted authority of the DBA user id, but what I am looking for is the actual Domain Network user id that inserted or updated the record for audit control purposes.

  • Please be sure you click "Add topic" and not "add poll".

    How is the person connecting to SQL Server? If it's windows authentication, then you can use suser_sname(). If it's SQL authentication, you can't get the Windows information.

  • The SQL Server Authentication is Mixed mode which is required by the vendor application. The vendor application has an active auditlogin table that contains the computer/system IP address of the user's workstation which also has a link to the vendor application's internal user table for it's own internal application security.

    So given the Mixed mode SQL Authenication and the above, is there SQL scripted code that would give me the TCPIP address of the workstation and thereby I could get user id within a table trigger when inserts and updates are done?

  • Mixed mode means you can use either SQL or Windows authentication. It doesn't mean you are using one or the other.

    If you are using SQL authentication, you can only base things on the id used to connect to SQL Server. You don't know which Windows user made the connection. The IP and hostname are passed by ODBC/OLEDB by default, but they aren't necessarily accurate. The client passes this information itself and it could be spoofed. It isn't automatically gathered by the server.

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

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