Question

I am working on SQL Server 2008. I have created a trigger on a table which will send a notification mail if the records are updated. I have included what is getting updated in body of the mail. Along with that I also want to include who has updated the records. Some information like login name. Is it possible? And if yes, how can I do that? Please help.

Was it helpful?

Solution 2

Are you familiar with the USER_NAME and SUSER_SNAME functions? Not sure how your trigger is configured, but in my triggers I use them to add entries to an audit table indicating who updated or inserted rows. So you should be able to add them to whatever SELECT statement is feeding your email.

OTHER TIPS

Check information about SUSER_NAME() built in function. Hope it'l help

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top