Is possible have INSTEAD INSERT and AFTER INSERT inside the same trigger?
CREATE TRIGGER tgInsertCompare
ON trigger_insert_teste
INSTEAD OF INSERT
AS
DECLARE @testeID2 int
SET @testeID2 = (SELECT TOP 1 id FROM trigger_insert_teste ORDER BY id DESC)
PRINT(@testeID2)
GO
AFTER INSERT
AS
BEGIN
SET NOCOUNT ON;
DECLARE @testeID int
SET @testeID = (SELECT TOP 1 id FROM trigger_insert_teste ORDER BY id DESC)
PRINT(@testeID)
END
GO
Using SQL Server 2008.
No, but why would you need to? If you’re controlling the insertion yourself (using
INSTEAD OF), you should be able to add theAFTER INSERTcode to the end.