Results 1 to 4 of 4

Thread: GetUserName()

  1. #1
    Join Date
    Oct 2003
    Posts
    311

    Unanswered: GetUserName()

    i want the user who entered data to a table to have there name logged, i thought there was a way to put this as the column default maybe my function name GETUSERNAME() isnt correct.

    Also i am using SQL 2005, i used to be able to look at common objects in the object browser in 2k, but now dont know where to find them?


    Thnks

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Please post what you've tried, whether it worked or not. That will give us a head start on helping you find a solution.

    What tools(s) are you using with SQL 2005? Different options are available with Visual Studio, the SQL 2005 Developer edition, the Client tools, etc. Browsing objects is a client tool function, so you'll get different answers depending on what tool(s) you use.

    -PatP

  3. #3
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    47
    create the column with default as system_user.
    example :
    create table #temp
    (
    col1 int,
    username varchar(100) default system_user
    )

    insert into #temp(col1) select 1
    select * from #temp
    -----------------
    KH


  4. #4
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    I use suser_sname().

    For all available options, look up "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

Posting Permissions

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