I have read through related posts but have not yet found an answer so if I may:
I have a column created in my table as follows:
[Arrival] time NOT NULL,
What is the most efficient way to perform a query like this:
select * from myTable where "Arrival is 1 hour from now" ?
DATEDIFF(hour, GETDATE(), Arrival)
gives me a very large value, possible because of the 1901,0,0 date part of Arrival. Still trying to understand this so if anyone has a quick answer for me, that will be great.
Again, performance is critical.
Thanks.
I'd probably do something like ...
or, using your hour
edit: Also, if performance is critical then I would also suggest validating input to not allow ancient dates. If you have recurring schedules that are not dependent on year, or even month (essentially, you're just looking for hours and minutes) then some usage of DatePart would be appropriate.