Return OS Userid in trigger

  • How can I determine the Windows (XP) userid in a trigger or in any other statement?

  • .. try something like this in your trigger:

    select  SYSTEM_USER,HOST_NAME(),user_name(),SESSION_USER,current_user

    Rgds

    R

  • 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

     

     

  • 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

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • 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