File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -435,15 +435,24 @@ AND ca.utc_timestamp < @end_date';
435435 END ;
436436 ELSE
437437 BEGIN
438- /* 2017+ handling */
438+ /*
439+ 2017+ handling. Use the same half-open (>= @start_date AND
440+ < @end_date) shape as the pre-2017 branch so an event captured
441+ at exactly @end_date is not included on 2017+ while excluded
442+ on pre-2017 — previously BETWEEN meant a closed interval on
443+ 2017+ and a row at the boundary could appear or not depending
444+ on which branch ran.
445+ */
439446 SET @cross_apply = N ' CROSS APPLY xml.{object_name}.nodes('' /event'' ) AS e(x)' ;
440447
441448 IF @timestamp_utc_mode = 1
442449 SET @time_filter = N'
443- AND CONVERT(datetimeoffset(7), fx.timestamp_utc) BETWEEN @start_date AND @end_date' ;
450+ AND CONVERT(datetimeoffset(7), fx.timestamp_utc) >= @start_date
451+ AND CONVERT(datetimeoffset(7), fx.timestamp_utc) < @end_date' ;
444452 ELSE
445453 SET @time_filter = N'
446- AND fx.timestamp_utc BETWEEN @start_date AND @end_date' ;
454+ AND fx.timestamp_utc >= @start_date
455+ AND fx.timestamp_utc < @end_date' ;
447456 END ;
448457
449458 SET @sql_template =
You can’t perform that action at this time.
0 commit comments