Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Server level Login variable for trigger? Expand / Collapse
Author
Message
Posted Friday, December 04, 2009 11:17 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued 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
Posted Friday, December 04, 2009 11:52 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 5:22 PM
Points: 5,471, Visits: 23,509
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
Posted Friday, December 04, 2009 11:56 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued 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
Posted Friday, December 04, 2009 12:46 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 5:22 PM
Points: 5,471, Visits: 23,509
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
Posted Friday, December 04, 2009 12:47 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Friday, January 03, 2014 3:52 PM
Points: 6,066, Visits: 5,277
Try this one:
http://msdn.microsoft.com/en-us/library/ms191126.aspx

CEWII
Post #829201
Posted Friday, December 04, 2009 3:54 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 5:22 PM
Points: 5,471, Visits: 23,509
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
Posted Friday, December 04, 2009 5:35 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Yesterday @ 4:31 PM
Points: 32,780, Visits: 14,941
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
Posted Monday, December 07, 2009 8:13 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Friday, January 03, 2014 3:52 PM
Points: 6,066, Visits: 5,277
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 »

Add to briefcase

Permissions Expand / Collapse