I have a SQL Server 2014 database with 2 fields:
- one of type date for the record date
- one of type time for the record time.
I want to retrieve records from the table between 2 dates/ times. Example: from 2015-01-01 at 16:00 until 2015-01-02 at 08:00.
I tried
SELECT...
Date BETWEEN '2015-01-01' AND '2015-01-02'
AND Time BETWEEN '16:00' AND '08:00'
This fails, as expected.
Can I do what I want or only if I use a single field for date and time (datetime type)?