To create a trigger in sql for my requirement
The fo开发者_开发知识库llowing is my tables
table1
=========
id col1 col2
=====================================
1 firstrow firstrow2
2 secrow secrow2
table2
===========
id orignalvalue updatedvalue
===============================================
2 secrow2 Secondrow2
i need a trigger when my table1 values are updated,a row to be created in the table2 with the id,originalvalue and the updatevalue in it...This is just like an LOG table.
You're basically looking at an AFTER UPDATE
trigger to insert the OLD
and NEW
values into table2
but without knowing which DB you're using, the syntax may differ or it might not even be possible.
精彩评论