Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Trigger on update
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Posting Yak Master

181 Posts

Posted - 09/26/2013 :  10:04:33  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

3873 Posts

Posted - 09/26/2013 :  11:10:39  Show Profile  Reply with Quote
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.
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000