Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

How to send one single mail each time a table is updated with a batch of rows

$
0
0

Hi!

I would like to send one mail each time an integrations services inserts a batch of rows. I,ve tested with this code but it sends one mail for each row that is inserted to the table. How to adjust the code below so it only sends one email?

Br Arne

CREATE TRIGGER trao_FOBOSTAFKbelopp
	ON FOBOSTAFKbelopp
	AFTER INSERT
AS
BEGIN
	EXEC msdb.dbo.sp_send_dbmail
	@profile_name = 'ArneSqlDatabasemail',
	@recipients = 'arne.olsson@ncc.se',
	@subject =  'Ny förkalkyl',
	@body = 'Hej!
	En ny förkalkyl har registrerats. 
	För att titta på den klicka på bifogad länk.
	Hälsningar 
	Arne'
END

  


Arne Olsson


Viewing all articles
Browse latest Browse all 23857

Trending Articles