LearnItFirst User Forum

SQL Server 2008 SSAS Training Videos
Welcome Guest Search | New Posts | Members | Log In | Register

Problem with comaparing exact date in WHERE part of query.... Options
mykill102
Posted: Thursday, December 17, 2009 7:22:13 PM
Rank: Newbie

Joined: 12/17/2009
Posts: 1
Points: 3
Where do you live?: philippines
Hi...

I got a problem with comparing date on WHERE part of my query even the date is in exact format...

Table Name : cash_up
Field: date_out
date_out value: '2009-12-17 10:45:52.5900000'

Note: CAST('2009-12-17 10:45:52.5900000' as datetime) = '12/17/2009 10:45:52 AM'



My Query:

SELECT
CAST(date_out as datetime) as date_out
FROM cash_up
WHERE
CAST(date_out as datetime) = '12/17/2009 10:45:52 AM'


I got no result.....

somebody know how can i fix this.... please ...
many thanks for any reply.....

bklr
Posted: Monday, December 28, 2009 1:15:48 AM

Rank: PFY

Joined: 1/21/2009
Posts: 27
Points: 81
Where do you live?: India
SELECT
CAST(date_out as datetime) as date_out
FROM cash_up
WHERE
CAST(date_out as datetime) = DATEADD(d,DATEDIFF(d,0,'12/17/2009 10:45:52 AM'),0)
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.