Click here to Skip to main content
15,879,535 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to fire trigger only once after insert into statement execution (multiple insert)?


What I have tried:

Tried the same, but the trigger is fired for every row insert
Posted
Updated 17-Dec-19 7:03am

1 solution

The trigger will be fired after each DML statement. You cannot change that. But you can insert multiple rows in a single statement:
SQL
INSERT INTO YourTable (Columns)
VALUES
    (Row 1),
    (Row 2),
    (Row 3)
;

-- Or:
INSERT INTO YourTable (Columns)
SELECT ColumnsFromOtherTable
FROM SomeOtherTable
WHERE ...;
 
Share this answer
 
Comments
Maciej Los 17-Dec-19 15:01pm    
5ed!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900