Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Old Forums
 CLOSED - SQL Server 2005/Yukon
 DateTime Format Problem in Query

Author  Topic 

SKS18
Starting Member

2 Posts

Posted - 2007-03-08 : 06:36:31
My MaintenanceLog table has an entry with following data in a row.
Name: Toney Mirra
ActualDateTime: 2007-02-16 12:55:02.867
PlannedDateTime: 2008-12-05 20:08:57.000
Comments: Sample Entry

But when I run the following query it doesnt return any value.
I think there is some problem in DateTime format. Can anyone help me fixing this?

select Comments from MaintenanceLog where
ActualDateTime = '2/16/2007 12:55:02 PM' and
PlannedDateTime = '12/5/2008 8

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-03-08 : 07:06:42
[code]
select Comments
from MaintenanceLog
where ActualDateTime = '20070216 12:55:02.867'
and PlannedDateTime = '20081205 20:08:57.000'
[/code]


KH

Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-03-08 : 07:06:43
Obviously, it's not going to return any record since you are not considering millisecond part in your WHERE clause.


Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page
   

- Advertisement -