>CREATE PROCEDURE dbo.GetSpotsByCompanyIDWithRange >( > @CompanyID UniqueIdentifier, > @StartRange DateTime, > @EndRange DateTime, > @Sentinel Bit, > @SentinelMark VarChar >) >AS >BEGIN > SET NOCOUNT ON; > > SELECT s.Track_Id, > s.CompanyID, > s.TruckID, > t.TruckCode, > s.DriverID, > s.Truck_Ip, > s.IsTip, > s.Spot_Message, > s.Route_Day, > s.Route_Number, > s.Municipality, > s.Upload_Id, > s.Spot_Latitude, > s.Spot_Longitude, > s.Spot_Heading, > s.Spot_Speed, > s.Spot_Altitude, > s.Spot_Time, > s.Spot_Status, > s.Sentinel, > s.Record_Status, > s.Record_Status_dt > FROM TrackSpot s, TruckAccess t > WHERE s.TruckID = t.TruckID > AND s.CompanyID = @CompanyID > AND Spot_Time >= @StartRange > AND Spot_Time <= @EndRange > AND Sentinel = @Sentinel > >END >GO >>
CREATE PROCEDURE dbo.GetSpotsByCompanyIDWithRange ( @CompanyID UniqueIdentifier, @StartRange DateTime, @EndRange DateTime, @Sentinel Bit, @SentinelMark VarChar ) AS BEGIN SET NOCOUNT ON; SELECT s.Track_Id, s.CompanyID, s.TruckID, t.TruckCode, s.DriverID, s.Truck_Ip, s.IsTip, s.Spot_Message, s.Route_Day, s.Route_Number, s.Municipality, s.Upload_Id, s.Spot_Latitude, s.Spot_Longitude, s.Spot_Heading, s.Spot_Speed, s.Spot_Altitude, s.Spot_Time, s.Spot_Status, s.Sentinel, s.Record_Status, s.Record_Status_dt FROM TrackSpot s, TruckAccess t WHERE s.TruckID = t.TruckID AND s.CompanyID = @CompanyID AND Spot_Time >= @StartRange AND Spot_Time <= @EndRange AND Sentinel = @Sentinel UPDATE ........ FROM TrackSpot s INNER JOIN TruckAccess t ON s.TruckID = t.TruckID WHERE s.CompanyID = @CompanyID AND Spot_Time >= @StartRange AND Spot_Time <= @EndRange AND Sentinel = @Sentinel END