Skip to content
Advertisement

Sql 2016 – How to get only modified column in system-versioned temporal table

How to get only modified column in system-versioned temporal table.

I am using SQL 2016 system-versioned temporal table to track the changes. I have the history table populated with multiple rows which include modified and not modified columns for each version of row edit.

Is there any way to get only modified column value from history row data.

Appreciated your response.

Thanks

Abdul

Advertisement

Answer

I used this approach to solve the problem.

  1. Fetch all history and transaction records and Partitioned with Primary key.

  2. Cross Apply the table to make row structure is Column Name and Column Value and of course other IDs like Primary Key, Partitioned Key, etc

  3. Compare Column value based on Column Name, Primary key and Partition Key

Please let me know if any good approach.

Regards
Abdul

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