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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Date compare

Author  Topic 

DeepakNewton
Starting Member

39 Posts

Posted - 2008-06-18 : 08:00:26
Hi All,
I have a doubt in checking the two Dates
Can i compare like the below statement i just want to compare only dates
CONVERT(DATETIME ,'12/31'+ '/' + '2008' )
= CAST (FLOOR(CAST(getdate() float)) As Datetime)

Please input ur suggestions

Thanks
Deepak

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-06-18 : 08:53:07
Yes you can.
But the comparison is taken out of context. Maybe we'll have a better answer if you provide us full detail of how you are going to use the comparison.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-06-18 : 09:06:38
quote:
Originally posted by DeepakNewton

Hi All,
I have a doubt in checking the two Dates
Can i compare like the below statement i just want to compare only dates
CONVERT(DATETIME ,'12/31'+ '/' + '2008' )
= CAST (FLOOR(CAST(getdate() float)) As Datetime)

Please input ur suggestions

Thanks
Deepak


Where datecol>=dateadd(day,datediff(day,0,getdate()),0) and
datecol<dateadd(day,datediff(day,0,getdate()),1) and


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -