Results 1 to 4 of 4

Thread: How to get logins during Audit

  1. #1
    Join Date
    Oct 2007
    Posts
    15

    How to get logins during Audit

    Hi,

    I am creating a trigger for updates and inserts to audit these types of transactions on a specified table.

    My problem is that the function USER_NAME() and the variable USER only return the dbo username when I use them to capture the logins.

    I know the logins are stored in the sys.syslogins table but is there some function or SQL variable that can capture the actual user's login name that I can use for the audit table? If someone could simply point me in the right direction it's no biggie and I can do the footwork.

    thx.

    Oh, P.S. I don't want to use the C2 Audit mode as an option
    Last edited by mindscape; 09-02-2008 at 08:54 PM. Reason: Forgot to add P.S.

  2. #2
    Join Date
    Sep 2002
    Posts
    5,938
    Tried with suser_name() or suser_sname()?

  3. #3
    Join Date
    Oct 2007
    Posts
    15

    Smile

    Thanks for the reply.

    Yes, actually I stumbled across the SUSER_SNAME() function after searching further on different keyword combinations a couple of days after this post and found that it was what I was looking for.

    I wasn't aware that there was also the SUSER_NAME() function as well and don't really know the significant difference between the 2 since they both seem to produce the same results.

    But I really appreciate the reply.

    Thx.

  4. #4
    Join Date
    Jun 2007
    Posts
    41
    There is a system view sys.sysprocesses which contains loginname for each process.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •