Thursday, March 22, 2012

Current user in SQL

Hi

Is there a variable or a possibility to use the current user in sql?

I would like to create an update trigger and write the user that made the change in the affected table!

Thanks!

Try SUSER_NAME() for the login or USER_NAME() for the database user.

|||

Pick your poison ;-)

SELECT SUSER_SNAME(),USER_NAME(),CURRENT_USER


Denis The SQL Menace
http://sqlservercode.blogspot.com
http://sqlblog.com/blogs/denis_gobo/default.aspx

No comments:

Post a Comment