Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Pete_N
Posting Yak Master
181 Posts |
Posted - 2013-09-26 : 10:04:33
|
I have a table that is updated from an external application. I have tried writing a simple update trigger but the problem is that the external application updates x number of records in on hit. As i understand it , a trigger work on the last record from inserted. Is there a way around this ? |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-09-26 : 11:10:39
|
A trigger gets invoked once per DML statement (insert/update/delete), no matter how many rows are affected by that DML statement.You have access to all the affected rows from within the trigger via two virtual tables: INSERTED and DELETED.For Insertions, there will be nothing in the DELETED table.For Deletions, there will be nothing in the INSERTED table.For Updates, the DELETED table will have the data as it existed before the update, and INSERTED table will have the data as it existed after the update. |
|
|
|
|
|