Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Server level Login variable for trigger?


Server level Login variable for trigger?

Author
Message
tripower
tripower
SSC Journeyman
SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)

Group: General Forum Members
Points: 83 Visits: 123
I have a trigger where I want to log the current Logged in user. Is there a server level variable that captures this info and if so what is it?
bitbucket-25253
bitbucket-25253
SSCertifiable
SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)

Group: General Forum Members
Points: 6109 Visits: 25280
Let me refer you to Books On Line
ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/e31254f1-6c41-4cbf-98b5-54daa7f81fd9.htm
and you can learn how to use the user's login name or user name.

If everything seems to be going well, you have obviously overlooked something.

Ron

Please help us, help you -before posting a question please read

Before posting a performance problem please read
tripower
tripower
SSC Journeyman
SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)

Group: General Forum Members
Points: 83 Visits: 123
That link is not an html link.
bitbucket-25253
bitbucket-25253
SSCertifiable
SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)

Group: General Forum Members
Points: 6109 Visits: 25280
Sorry about that link being faulty. Use books on line and search for:
CURRENT_USER (Transact-SQL)
Functions That Return User Names and User IDs
SESSION_USER (Transact-SQL)
USER (Transact-SQL)
USER_NAME (Transact-SQL)

Believe that one of these functions will return what you are looking for.

Again, sorry about that link being faulty.

If everything seems to be going well, you have obviously overlooked something.

Ron

Please help us, help you -before posting a question please read

Before posting a performance problem please read
Elliott Whitlow
Elliott Whitlow
SSCertifiable
SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)

Group: General Forum Members
Points: 6860 Visits: 5314
Try this one:
http://msdn.microsoft.com/en-us/library/ms191126.aspx

CEWII
bitbucket-25253
bitbucket-25253
SSCertifiable
SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)SSCertifiable (6.1K reputation)

Group: General Forum Members
Points: 6109 Visits: 25280
Elliott W
Try this one:
http://msdn.microsoft.com/en-us/library/ms191126.aspx


The above link refers to SQL Server 2008 Books Online (October 2009)
and the user has posted his/her question to a SQL 2005 forum.

If everything seems to be going well, you have obviously overlooked something.

Ron

Please help us, help you -before posting a question please read

Before posting a performance problem please read
Steve Jones
Steve Jones
SSC-Forever
SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)

Group: Administrators
Points: 40127 Visits: 18845
suser_sname() - http://msdn.microsoft.com/en-us/library/ms174427%28SQL.90%29.aspx

user_name() - http://msdn.microsoft.com/en-us/library/ms188014%28SQL.90%29.aspx

There are related functions in those links as well. Pick the one that suits your needs.

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
Elliott Whitlow
Elliott Whitlow
SSCertifiable
SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)

Group: General Forum Members
Points: 6860 Visits: 5314
bitbucket-25253 (12/4/2009)
Elliott W
Try this one:
http://msdn.microsoft.com/en-us/library/ms191126.aspx

The above link refers to SQL Server 2008 Books Online (October 2009)
and the user has posted his/her question to a SQL 2005 forum.

True but the differences are pretty marginal for this...

CEWII
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search