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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Instead of trigger

Author  Topic 

X-Factor
Constraint Violating Yak Guru

392 Posts

Posted - 2005-12-20 : 20:54:11
Hi,

I need to cascade some updates when a row is updated but, in order to save redundant updates, I only want to do the cascade if only one column in the table has changed its value.

I think the only way I can do this is with an INSTEAD OF update trigger because then I can compare the value in the inserted table with the value in the actual database.

So after this comparison and cascade, because its an instead of trigger, the trigger needs to manually update the table.

This means doing an update statement on the table for every column in the table.

My question is.. is doing this update of every column what the db would do without the insert trigger or would the db only update the colums that have changed or been in the client's update statement?

I know there's an operator (IF UPDATE) for finding out whether a column has been updated but there would be a crazy number of combinations to choose from to run an update statement that updated only the columns that had actually been updated.
   

- Advertisement -