Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 SQL Logon Variable for INSERTS and UPDATES

Author  Topic 

richxyz
Starting Member

12 Posts

Posted - 2007-08-30 : 15:55:02
I have added columns to my tables and would like to capture who created and modified the rows. In stored procedures, is there a variable I can use to return the username that called the sp?

For example, can I add into my INSERT or UPDATE a variable like @@user or something that automatically gets the SQL Logon?

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-08-30 : 21:59:15
Try current_user function.
Go to Top of Page

ZeyNep
Starting Member

1 Post

Posted - 2007-08-31 : 08:11:51
you can use
user_name() or suser_sname() or current_user
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-08-31 : 15:44:32
You need user id in user_name().
Go to Top of Page
   

- Advertisement -