If the user is making this call from a client machine it should be easy enough. You can use the user_name() function, provided each person has a separate login. This can get to be a pain to administer, unless you have them all on Windows Authentication.
If you have a website that is running this call, then it gets a lot trickier (and well out of my experience.) Good luck.
You are limited to the niladic functions native to SQL server unless you set up an application-specific security system. For example, an application I developed required each user to login, after which they were given a session-specific security token which had to be submitted as a parameter to all future function calls. This made it easy to track who was doing what through any interface they might use.
Originally posted by Brett Kaiser
Yeah, but as the blide dude suggests, it may not be that simple?
How does your application connect to the database?
Do you have an applciation, or are you just trying to bust some bs developers?
The application is COM+ dll that it is call (instantiated) from another apllication that runs on IEclient Intranet App.
I want to know (log) Who is making a Query And From Where it is make, this is very important due to the cleint aplication is a intranet application. Client are fromn different parts of the oiraganizacion and I could'nt catch correctly the logging information.