Skip to content
Advertisement

Capturing difference between 2 tables in one table

I understand my mistake with creating questions in StackOverflow, so I want to rewrite my question.

I have two tables. One of them is my target table with old data and the source table with new data. Implicitly I want to compare these 2 tables and get information on which columns have been changed and changed status.

So I created new temporary tables as below:

I want to capture changes, where changes are called “closed” and insert getdate() in these changes. But I can’t, I tried using except statement to get information on which columns have been changed:

My final step shows ID and status, but how to insert the date of change in except statement to get a table as below? ID|Statuss|ChangedStatus|Dateofchanged|

Advertisement

Answer

here is one approach

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement