I am trying to get a query to work. I have a table that includes a column REQDATE that is a datetime type. I need to return all records for a span of time REQDATE between '03/30/2009' and '04/06/2009'. With the records returned I need to return all the records where the time is between 17:00:00 hours and 08:00:00 hours. I am having trouble with this part. The datetime is written like 08:00:00 AM, not in 24-hour time.
WHERE (DATEPART(hh, REQDATE) BETWEEN '17:00:00' AND '08:00:00') AND (REQDATE BETWEEN CONVERT(DATETIME, '2009-03-30 00:00:00', 102)
AND CONVERT(DATETIME, '2009-04-06 00:00:00', 102))