Firing trigger on a bulk like insert
-
Hi all, I have implemented a functionality shown here[^] on codeproject. This method generates xml from ntext and inserts it into table. Now i want a trigger on this table which inserts in other table when each row is inserted.But the problem is that when the trigger fires, the inserted table contains all the rows that are inserted in the table (i guess since it was inserted all at once) and hence i m not able to insert it in other table bcas i have to perform some operation on the data also. Is there a method so that the trigger fires for each row and not all at once????
When you fail to plan, you are planning to fail.
-
Hi all, I have implemented a functionality shown here[^] on codeproject. This method generates xml from ntext and inserts it into table. Now i want a trigger on this table which inserts in other table when each row is inserted.But the problem is that when the trigger fires, the inserted table contains all the rows that are inserted in the table (i guess since it was inserted all at once) and hence i m not able to insert it in other table bcas i have to perform some operation on the data also. Is there a method so that the trigger fires for each row and not all at once????
When you fail to plan, you are planning to fail.
I have not used openxml so I am assuming a bulk insert is used and the trigger is by passed (I also never, ever use triggers). So why not grab the Details ID, insert the records, get the last ID inserted, call a proc for the detail between. Ugly and subject to other user interference. OR Don't use openxml - I am surprised the insert does not fire the insert trigger
Never underestimate the power of human stupidity RAH