Reputation: 48492
I have a SQL Server 2016 temporal table. I executed a query which can be seen below, along with the results. I'm curious why the row highlighted in green is included. The ValidFrom value occurs before the begin date of '7/12/2018 19:16:00' and the ValidTo occurs after the end date of '7/12/2018 19:30:00'.
My understanding of BETWEEN / AND, which might be incorrect, is that it finds all rows modified between two points in time.
Upvotes: 2
Views: 277
Reputation: 3756
The BETWEEN clause on a temporal table shows those rows that were active during the selected timeframe. In more conventional terms, the rows that meet this criteria set:
WHERE StartTime <= <EndDateTime>
AND EndTime > <StartDateTime>
As you can see, this does not require an actual time stamp to fall within your BETWEEN dates.
Upvotes: 2