Results 1 to 9 of 9
  1. #1
    Join Date
    Apr 2004
    Posts
    101

    Unanswered: User information!!

    Hi,
    I'm trying to get the information about the user who modified the record in the table. I'm able to capture the datetime of modification through trigger.

    CREATE TRIGGER [upd_dtm] ON dbo.Sample
    FOR INSERT, UPDATE
    AS
    BEGIN
    UPDATE Sample SET update_dtm = (SELECT GETDATE())
    WHERE Sample.ID IN (SELECT ID FROM inserted)
    END

    I'm stuck, how to get the User who modified it?
    Any help is greately appreciated!

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Search for NILADIC functions in Books Online.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  3. #3
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Can't you just give it to him/her?

    SELECT SYSTEM_USER, USER

    EDIT: And I still don't even inderstand the definition

    http://computing-dictionary.thefreed...ry.com/niladic
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  4. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    A Niladic (or Nullary) function is one that takes no arguments.

    -PatP

  5. #5
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    'Cause there are several, and they return subtley different results so why parrot Books Online?

    Teach a man to fish...


    OK, I'm just lazy. A lazy DBA.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  6. #6
    Join Date
    Apr 2004
    Posts
    101
    I got it..
    I used current_user function.
    Thanks guys.

  7. #7
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Thank you kind sir
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  8. #8
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    I think you want SYSTEM_USER though....
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  9. #9
    Join Date
    Apr 2004
    Posts
    101
    Yep, System_user is the correct one. thanks.

Posting Permissions

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