Search code examples
sqlsql-servertemporaltemporal-database

SQL Server 2016 - Period start and end datetime set manually


I'm trying to load some historical data that is time based and I would like it to be in a temporal table in SQL Server 2016.

As far as I see, the period start and end date cannot be manually set, they are set at insert/update/delete time using the system time.

However, the files I am trying to load have a specific date on when the data would have been available and I would like that to be reflected in the period start date so I can query it accordingly.

Is there any way to set the period start and end time manually?


Solution

  • You're missing the point of Temporal tables. The system start and end dates are there for one purpose only; to provide history of what was in the table and when. Your requirement to store the date \ time that the data would have been available is different. I suggest that you create a column to hold that data aside from the system columns.