I have an issue where I'm trying to get an specific record where I have two dates to get an record.
The date are as follows:
StartTime: '2018-03-02 09:00:00.000'
EndTime : '2018-03-02 11:00:00.000'
From the dates above im trying to get the row number 5. I have tried it like so:
SELECT *
FROM [data].[EmergencyOrders]
WHERE [Workcenter] = @Workcenter
AND [StartDatetime] > @StartTime
AND ISNULL([EndDatetime], GETDATE()) < @StopTime
But can't seem to get it to work correctly.