3 IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[vGetVisits]') AND type in (N'U'))
0 Since this *is* a SQL Server 2014 question I might as well add a natively compiled stored procedure version of a "cursor".
Why does this seek on BIGINT col have extra constant scan, compute scalar, and nested loops operators?
3 SQL Server uses different calculations in different situations. Your example is different from the linked Q & A because your range is entirely contained within a step; it does not cross a step boundary. It is also an interval with two ends rather than one. Writing `BETWEEN` is the same as writing two separate predicates with `>=` and `<=`.