March 13, 2007 at 1:30 am
How can I determine the Windows (XP) userid in a trigger or in any other statement?
March 13, 2007 at 2:56 am
.. try something like this in your trigger:
select SYSTEM_USER,HOST_NAME(),user_name(),SESSION_USER,current_user
Rgds
R
March 13, 2007 at 3:22 am
None of the above displays the Windows userid.
---------------------------------------------------------------------------------
SYSTEM_USER HOST_NAME user_name SESSION_USER current_user
CAdmin PTC-DDV-0576 dbo dbo dbo
---------------------------------------------------------------------------------
I am looking for the userid that is loged on to the Server/PC eg. C0001
March 13, 2007 at 6:40 am
select suser_sname()
This is assuming they're using windows authentication to connect to the server. If thery're using sql authent, then there's no way I know of to find the windows login.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
March 13, 2007 at 9:05 pm
That is the problem (I am not using windows authentication).
I am used to working in Oracle and there you just use --- sys_context('userenv', 'os_user') --- to return the current Windows userid.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply