Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get current UserId within a SQL trigger? 1

Status
Not open for further replies.
May 24, 2006
219
US
We are writing a trigger to track when changes are made to a particular table. Unfortunately, this particular table does not have a column like "MODIFIEDBY". Isn't there a global variable I can retrieve from within a SQL trigger?
 
This might help....

create trigger [trackEmployeeAdditions] on UPR00100
for insert
as
insert trackPayrollChanges
select system_user,'UPR00100','Inserted Record',getdate(),'Inserted Record','Inserted Record',EMPLOYID,
'Employee '+rtrim(EMPLOYID)+' was added' from inserted
 
Got it... that "system_user" was what we were looking for. Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top