Select
r.Id,
r.Date,
r.Position.Lat Lat,
r.Position.Long Lng,
r.DriverId,
r.VehicleId,
--IsNull(t.DriverId, r.DriverId) DriverId,
--v.Name GroupName,
l.Name LayerName
From
Operation.vw_AllRecord as r --The View
Inner Join @entityIds Ids
On Ids.Id = r.VehicleId
Inner Join @LayerPointCache l
ON r.Position.Lat Between MinY
And MaxY And r.Position.Long Between MinX And MaxX
Where
r.Date Between @StartDate And @EndDate And
r.HasPosition = 1
there is error on this line
ON r.Position.Lat Between MinY And MaxY And r.Position.Long Between MinX And MaxX
saying:
Cannot call methods on varbinary
Please note that Operation.vw_AllRecord
is a view