Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL SERVER 7.0 TRIGGER
Message
From
07/04/2000 10:00:28
 
 
To
06/04/2000 12:26:29
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00350975
Message ID:
00356829
Views:
12
>Daniel,
>Our understanding is that the update trigger is fired after the row is updated and the trigger is processed using the updated values. We are trying to get at the old values in the record prior to the update. We need to do some comparison of the previous value with the updated value.
>Any thoughts on how to get at the old value would be greatly appreciated.

You're only partially right. The UPDATE trigger does fire after the row is updated but remember how SQL Server works: the old record is deleted, and a new record created (identity columns remain the same). This is where the INSERTED/DELETED temp tables come into play. The old values are stored in the DELETED table, the new ones in the INSERTED table. These values exist for the duration of the trigger call.

If you are trying to prevent an update based on a comparison between the old and new...well, you can't. But you can use the values in the DELETED table to "reset" if necessary (I'm not sure I'd do it that way, but that's just me).

Hope that helps.
Dan LeClair
www.cyberwombat.com
SET RANT ON - The Wombat Blog

Life isn’t a morality contest and purity makes a poor shield. - J. Peter Mulhern
Disclaimer: The comments made here are only my OPINIONS on various aspects of VFP, SQL Server, VS.NET, systems development, or life in general, and my OPINIONS should not be construed to be the authoritative word on any subject. No warranties or degrees of veracity are expressed or implied. Void where prohibited. Side effects may included dizziness, spontaneous combustion, or unexplainable cravings for dark beer. Wash with like colors only, serve immediately for best flavor.
Previous
Reply
Map
View

Click here to load this message in the networking platform