Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to Filter On DateTime Field with notime
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00742929
Message ID:
00742942
Views:
11
I would use
declare @ttRecoveryStart datetime
declare @ttRecoveryEnd datetime
set @ttRecoveryStart = '10/01/2002 00:00:00'
SET @ttRecoveryEnd = DATEADD(ss, 86399, @ttRecoveryStart)
select * from meetings 
	where EnterRecovery between @ttRecoveryStart and @ttRecoveryEnd
>I have two fields EnterRecovery DateTime and ExitRecovery DateTime. I need to filter a query where these fields have 00:00:00 for the time portion. They will always have the date portion. Some of my records have times in them, others don't.
>
>Can I just use some like
>
>declare @ttRecoveryBetween datetime
>set @ttRecoveryFrom = '10/01/2002 00:00:00'
>
>select * from meetings
>where EnterRecovery between @ttRecoveryBetween and @ttRecoveryBetween
>
>
>
>Thanks
>Kirk
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform