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)
 Comparing date parts only?

Author  Topic 

alzogbi
Starting Member

9 Posts

Posted - 2003-12-17 : 07:03:04
Hi,
I have two datetime variables; @MyDate1 and @MyDate2. They both have date and time parts populated. I want to compare only the date part of each other and figure out which one is greater than the other.

How can this be done?

Thanks,


Mazen Alzogbi

nr
SQLTeam MVY

12543 Posts

Posted - 2003-12-17 : 07:05:11
where convert(varchar(8),@d1,112) >= convert(varchar(8),@d2,112)

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

alzogbi
Starting Member

9 Posts

Posted - 2003-12-17 : 07:09:22
much much appreciated. apparently that was easy

Mazen Alzogbi
Go to Top of Page

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2003-12-17 : 07:24:37
where datediff(dd,@MyDate1,@MyDate2) > 0

Jay White
{0}
Go to Top of Page

Amethystium
Aged Yak Warrior

701 Posts

Posted - 2003-12-17 : 07:35:03
Long time no see Jay. Hope all is well.

________________
Make love not war!
Go to Top of Page
   

- Advertisement -