Hello Dmitry N.Ananyev,
Quote:
SQL Mail Task - may run it by table trigger and send email with insert
information?
Is it possible?
Are anywhere examples? |
Hi, you could create a trigger on INSERT operation; in this trigger you could
execute the extended sp 'xp_sendmail' in which (for example) you send a
mail with the number of row inserted.
Just like this:
CREATE TRIGGER MyTrigger
ON dbo.Table1
FOR INSERT
AS
declare @rowsins int
declare @rowsinsSTR varchar(255)
SELECT @rowsins = count(*) FROM inserted
set @rowsinsSTR = 'Inserted ' + CAST( @rowsins AS varchar(255)) + ' rows'
EXEC master..xp_sendmail
@recipients = 'themailaddresses',
@message = @rowsinsSTR,
@width=100,
@subject = 'Inserted rows '
bye