August 24, 2016 at 11:30 am
Dear all,
I'm trying to find out the best why of inserting into a column e.g "ChangedData" if it has either been 'updated', 'deleted' or inserted.
Thank you in advance!
August 24, 2016 at 11:43 am
tt-615680 (8/24/2016)
Dear all,I'm trying to find out the best why of inserting into a column e.g "ChangedData" if it has either been 'updated', 'deleted' or inserted.
Thank you in advance!
perhaps you can provide some example data that describes what you mean.
________________________________________________________________
you can lead a user to data....but you cannot make them think
and remember....every day is a school day
August 24, 2016 at 11:58 am
Let's see if I understand correctly.
You want to change the value of a column to track changes on the table? Are your queries prepared to handle soft deletes? If you don't plan on handling soft deletes, you need to find a different way to track those changes.
August 24, 2016 at 11:59 am
I have 2 tables which has the following columns
Table1
ID,
CustomerName,
CustomerID
...,
...,
DateofUpdatedData
Table2
ID,
CustomerName,
CustomerID
...,
...,
DateofUpdatedData
DataupdateType
I want to insert into the "DataupdateType" column of table2 any data which has been either 'Updated', 'Deleted' or 'Inserted'
I hope that is clear but please let me know if you need me to explain further.
Thank you!
August 24, 2016 at 7:24 pm
You need to write a trigger to do this.
--Jeff Moden
Change is inevitable... Change for the better is not.
August 24, 2016 at 7:25 pm
p.s. It's also a huge waste of disk space to audit INSERTs. Only audit UPDATES and DELETEs. INSERTs will always be in the original table until they're updated, which is when the original data (the INSERT) would be copied to the audit table.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply