Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with query datetime filter
Message
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Problem with query datetime filter
Miscellaneous
Thread ID:
00745911
Message ID:
00745911
Views:
68
I am having something wierd...probably me, but if I use the between clause in the where portion, I get zero results. I am trying this in the QA. If I do begintime >= @ttQueryFrom I get results, but if I do begintime between @ttQueryFrom and @ttQuery to it returns nothing and if I do begintime >= @ttQueryFrom and begintime <= @ttQueryTo I get no results.


declare @tiDeptID int
declare @ttQueryFrom datetime
declare @ttQueryTo datetime

set @ttQueryFrom = '02/04/2002 00:00:00'
set @ttQueryTo = '02/04/2002 23:59:00'
set @tiDeptID = 23


select begintime,endtime
from meetings
where deptID = @tiDeptID
and begintime between @ttQueryFrom and @ttQueryTo
Next
Reply
Map
View

Click here to load this message in the networking platform