Pergunta

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.

Foi útil?

Solução 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.

Outras dicas

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top