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
 General SQL Server Forums
 New to SQL Server Programming
 Comparing Dates of Different Lengths

Author  Topic 

Frank in VA
Starting Member

2 Posts

Posted - 2008-04-09 : 16:45:44
Hi All,

Is there a way to compare two dates fields that are different in length? For example, I have table1.datefield with a date of '040808' and table2.datefield with a date of '04082008'. Just comparing the two fields is not coming up equal. Has anyone had this situation before?

Thanks.
Frank

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2008-04-09 : 16:54:24
Please post the actual data types of the columns that you are comparing.

Those look like they may be in some character string format, instead of a datetime column. If so, you will need to convert them to datetime to compare them.




CODO ERGO SUM
Go to Top of Page
   

- Advertisement -