Skip to content Skip to sidebar Skip to footer

How To Obtain Domain User Name When Connecting Via SQL Authentication

I have an application which connects to SQL Server 2000 (using a generic SQL Login and SQL Authentication). I would like to implement some logging via triggers to track data chang

Solution 1:

You can't. Simple. SQL Server has no knowledge of the end user with a SQL login at all

The same applies if you use a proxy (web server etc) too: you don't know the end user. We use parameters/stored procs to pass in the username from the web server.

I would suggest that you set CONTEXT_INFO in the client which persists for that connection.


Solution 2:

Have you tried SYSTEM_USER?

SELECT SYSTEM_USER

Post a Comment for "How To Obtain Domain User Name When Connecting Via SQL Authentication"