views:

27

answers:

1

Hi,

We have some tables where we store some sensitive information. These tables have one extra column "ModifiedBy". Currently we insert the value for this column programmatically.

I am wondering if we have some way to get the current unix user into SQL Server. The idea is to auto-populate the user name/id into that column with the use of triggers.

Thanks Nayn

+1  A: 

You don't mention the language or situation, so an answer is hard ...

presuming users are logged in and running a program, and that this program is a scripting language then you can execute whoami from the shell and use that value.

If you are using C, then see geteuid() and friends.

Aiden Bell
My apologies for being not-so-clear. I am using java. In java I can surely fetch the current user and put that value in the column.Actually my intention is not to do this explicitly.I want SQL Server to identify the current user. I could use that value in a trigger that updates the “ModifiedBy” for the updated/inserted rows.But as the things stand, a web application can run on any platform/operating-system and it is that applications duty to provide the current user information to the database.ThanksNayn
Nayn