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 datetime object

Author  Topic 

cognos79
Posting Yak Master

241 Posts

Posted - 2007-01-10 : 21:53:05
i do have a datetime field in a table e.g '12/1/2002 10:00:00 AM'

how do i compare if two dates are equal. I even need to compare the time stamp not just the date part.

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2007-01-10 : 22:04:14
Assuming they are actually datetime columns:
where datetime1 = datetime2




CODO ERGO SUM
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-01-11 : 01:41:27
And if they are not (you have somehow managed to store them as varchar)

where cast(datetime1 as datetime) = cast(datetime2 as datetime)


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -