Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Server 7.0 Triggers
Message
From
14/03/2000 19:07:24
 
 
To
14/03/2000 00:48:14
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00344975
Message ID:
00345625
Views:
23
>The old values can be accessed via the original table. The trigger is fired just before the changes are applied, so the
>target table(s) contain the old values.
>
Hi Vlad,

Because Andrew was looking for a way to get the old value from within the trigger itself, I am assuming that when you say the old values can be accessed via the original tables, you mean from within the trigger? With the tests I have done I haven't gotten that to work. I have found I must get the oldvalue from deleted within the trigger. Attempting to go to the original (trigger)table for the old value (within trigger) did not work for me, because the original (trigger) table already contains the new inserted or updated value. (This is for one row updates, inserts. I haven't had to deal with multi rows yet:) In fact the SQL Books on line appear to support this.

"During an INSERT or UPDATE transaction, new rows are added simultaneously to both the inserted table and the trigger table. The rows in the inserted table are copies of the new rows in the trigger table."

And...

"During the execution of a DELETE or UPDATE statement, rows are deleted from the trigger table and transferred to the deleted table. The deleted table and the trigger table ordinarily have no rows in common."

Perhaps I am misunderstanding your reply. Any further insight you may have would be most welcome.

Thanks
John

>
>>Does anyone know if it's easy to reference both old and new field values via triggers in SQL Server 7.0. e.g. If I was amending a balance detail record and changing the ordered quantity from 10 to 20, I would would want to update the ordered quantity on the balance header record by the (current header value + (new detail value - old detail value)) hence I would need to know what the new and old balance detail ordered quantities were. Thanks.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform