I have a post on pain that I experienced with temporal tables:
This query succeeds but returns results we don’t really want:
This brings back all 9 records tied to products 1 and 2 (because product 3 didn’t exist on July 2nd at 8 AM UTC). But it gives us the same start and end date, so that’s not right. What I really want to do is replace
@InterestingTime
withqsp
‘sDatePredictionMade
, so let’s try that:This returns a syntax error. It would appear that at the time
FOR SYSTEM_TIME
is resolved,QuantitySoldPrediction
does not yet exist. This stops us dead in our tracks.
This is one of the two things I’d really like to change about temporal tables; the other thing (now that auto-retention is slated for release) is the ability to backfill data without turning off system versioning.