December 5, 2006 at 12:24 pm
Relative newbie here, I need to write a select statement that will pull records from many different days but all between the hours of 3a and 6a, I've done some searching and poking but can't seem to get past this error message, though it feels like I'm close.
Here's what I have so far:
SELECT convert(varchar(10),calldatetime,8) AS HOURS
FROM Table
WHERE project = 999
AND DATEPART(hh, calldatetime)
BETWEEN '2006-12-01 00:03:00' and '2006-12-05 00:06:00'
When I run this I get the following error:
Syntax error converting the varchar value '2006-12-05 00:00:00' to a column of data type int.
Thanks in advance!
December 5, 2006 at 12:32 pm
SELECT convert(varchar(10),calldatetime,8) AS HOURS
FROM Table
WHERE project = 999
AND DATEPART(hh, calldatetime) BETWEEN 3 and 6
--or this depending on the requirements
or DATEPART(hh, calldatetime) >= 3 and DATEPART(hh, calldatetime) < 6
AND CALLTIME BETWEEN '2006-12-01 00:03:00' and '2006-12-05 00:06:00'
December 5, 2006 at 12:44 pm
thanks!
December 5, 2006 at 12:48 pm
HTH.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply