Domanda

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.

È stato utile?

Soluzione 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.

Altri suggerimenti

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top