SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Old Forums
 CLOSED - SQL Server 2005/Yukon
 DateTime Format Problem in Query
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

SKS18
Starting Member

2 Posts

Posted - 03/08/2007 :  06:36:31  Show Profile
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)

Singapore
17627 Posts

Posted - 03/08/2007 :  07:06:42  Show Profile

select Comments 
from   MaintenanceLog 
where  ActualDateTime  = '20070216 12:55:02.867'
and    PlannedDateTime = '20081205 20:08:57.000'



KH


Edited by - khtan on 03/08/2007 07:07:24
Go to Top of Page

harsh_athalye
Flowing Fount of Yak Knowledge

India
5514 Posts

Posted - 03/08/2007 :  07:06:43  Show Profile  Visit harsh_athalye's Homepage  Click to see harsh_athalye's MSN Messenger address  Send harsh_athalye a Yahoo! Message
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
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000