SQL Server Temporal tables

Ali Ahad 151 Reputation points
2023-09-29T01:40:22.1+00:00

I have been asked to track changes of a column, basically I will be getting flat files on a weekly basis that I need to upload then I need to compare each column values from the old file to the new file. I was researched online and came across temporal tables but not sure if it's the right approach. SIM_BS_Data

In the screenshot above line 1 column delivery model got changed this week (line 2) and I need to track it.

Thanks,

Ali.

SQL Server | Other
{count} votes

2 answers

Sort by: Most helpful
  1. Anonymous
    2023-09-29T05:35:38.4133333+00:00

    Hi @Ali Ahad

    Common methods of tracking data include Change tracking (CT), Change Data Capture (CDC) and Temporal Tables.

    Temporal table, also known as system version table. It allows SQL Server to automatically maintain and manage the history of data in tables. This feature provides a complete history of every change made to the data.

    You can refer to this document to confirm the Temporal table usage scenarios: https://learn.microsoft.com/en-us/sql/relational-databases/tables/temporal-table-usage-scenarios?view=sql-server-ver16.

    This article provides a simple example: https://www.sqlshack.com/temporal-tables-in-sql-server/.

    Hope these can help you.

    If the answer is helpful, please click Accept Answer and Up-Vote for the same. If you have any questions, please feel free to let me know.

    Best regards,

    Aniya

    0 comments No comments

  2. Erland Sommarskog 129.6K Reputation points MVP Volunteer Moderator
    2023-09-29T14:34:41.2+00:00

    If you want to know the answer to a question like "what was the data for customer X on 7 aug, 14:30", temporal tables are a good fit.

    Whether it is a good fit in your case, is not clear to me, because your description is too vague. If you load a file and all your want to do is to compare it to the current contents, then just load the file to a side table with the same structure. It could help if you could clarify what your ultimate aim is.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.