Insert trigger to run an ASPX script passing record columns as parameters


I am using SQL Server 2012 and my database is set to 'SQL Server 2000 (80)' compatibility level.

I have a table called "FORMS" and I need that an email be sent every time I get an INSERT in the table.

The email should contains a couple record info including the auto generated key (this is very important). I already have the ASPX script to send the email and I suppose that if this is possible it should be done using a trigger, right?

Could anyone please help me with the details about how to do that?

Thank you!

Hi YanKleber,

You can make a trigger like this on your table:

CREATE TRIGGER dbo.Forms_Insert ON dbo.Forms  
IF (@@ROWCOUNT  = 0)

DECLARE @key int;
SET @key = (select max(key_column) from inserted);

calling your script here...


In this case, you need to call your external script.

Used link:

MCSA: SQL 2016 Database Development
MCSE: Data Management and Analytics