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 |
raxbat
Yak Posting Veteran
52 Posts |
Posted - 2008-05-23 : 01:35:04
|
Hello! I have following trigger:CREATE Trigger ClearingFarm_UpdateOn dbo.ClearingFarmFor Update AsIF UPDATE(ask) INSERT INTO MovingAverage (broker_id, price, cur) SELECT broker_id, ask, symbol FROM InsertedHow can I update this triger to insert only NEW values of ask?For example, if new ask value is the same as old, I dont need to run the insert query!Thank You |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-05-23 : 02:20:08
|
CREATE Trigger ClearingFarm_UpdateOn dbo.ClearingFarmFor Update AsIF EXISTS (SELECT * FROM INSERTED i INNER JOIN DELETED d ON i.broker_id= d.broker_id AND i.ask <> d.ask)INSERT INTO MovingAverage (broker_id, price, cur) SELECT broker_id, ask, symbol FROM Inserted |
 |
|
raxbat
Yak Posting Veteran
52 Posts |
Posted - 2008-05-23 : 02:24:54
|
Thanx! |
 |
|
|
|
|