views:

45

answers:

1

The following 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.

A: 

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.

Phil Brown
DB means,i cant get your point..Could you please explain it
Prabhakaran
Database Management System. MySQL, SQL Server, Oracle, PostgreSQL, SQLite, etc
Phil Brown
iam using SQL SERVER
Prabhakaran