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.
How to include login information in an sql server mail?
66 views Asked by user2277333 At
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.