Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2005
»
SQL Server 2005 General Discussion
»
Server level Login variable for trigger?
Server level Login variable for trigger?
Rate Topic
Display Mode
Topic Options
Author
Message
tripower
tripower
Posted Friday, December 04, 2009 11:17 AM
Valued Member
Group: General Forum Members
Last Login: Thursday, May 17, 2012 5:39 AM
Points: 61,
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?
Post #829126
bitbucket-25253
bitbucket-25253
Posted Friday, December 04, 2009 11:52 AM
SSCertifiable
Group: General Forum Members
Last Login: Yesterday @ 9:21 AM
Points: 5,099,
Visits: 20,191
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
Post #829152
tripower
tripower
Posted Friday, December 04, 2009 11:56 AM
Valued Member
Group: General Forum Members
Last Login: Thursday, May 17, 2012 5:39 AM
Points: 61,
Visits: 123
That link is not an html link.
Post #829156
bitbucket-25253
bitbucket-25253
Posted Friday, December 04, 2009 12:46 PM
SSCertifiable
Group: General Forum Members
Last Login: Yesterday @ 9:21 AM
Points: 5,099,
Visits: 20,191
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
Post #829199
Elliott Whitlow
Elliott Whitlow
Posted Friday, December 04, 2009 12:47 PM
SSCertifiable
Group: General Forum Members
Last Login: Wednesday, April 24, 2013 12:02 PM
Points: 5,854,
Visits: 4,873
Try this one:
http://msdn.microsoft.com/en-us/library/ms191126.aspx
CEWII
Post #829201
bitbucket-25253
bitbucket-25253
Posted Friday, December 04, 2009 3:54 PM
SSCertifiable
Group: General Forum Members
Last Login: Yesterday @ 9:21 AM
Points: 5,099,
Visits: 20,191
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
Post #829303
Steve Jones - SSC Editor
Steve Jones - SSC Editor
Posted Friday, December 04, 2009 5:35 PM
SSC-Dedicated
Group: Administrators
Last Login: 2 days ago @ 1:47 PM
Points: 31,406,
Visits: 13,722
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
Post #829318
Elliott Whitlow
Elliott Whitlow
Posted Monday, December 07, 2009 8:13 AM
SSCertifiable
Group: General Forum Members
Last Login: Wednesday, April 24, 2013 12:02 PM
Points: 5,854,
Visits: 4,873
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
Post #829896
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.