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
 Check dates

Author  Topic 

nguyenl
Posting Yak Master

128 Posts

Posted - 2009-03-06 : 11:21:43
Hi,

I have a "date" column. There is a bad date in this column which is causing my scripts to fail. It is either not in this format mm/dd/yyyy or it has a "letter" in the month, day, or year field. Is there a good way to find the offending record? I have over 3 million records to search.

Thanks

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2009-03-06 : 11:26:09
[code]where isdate(MyDateColumn) <> 1 or isdate(MyDateColumn) is null[/code]

CODO ERGO SUM
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-03-07 : 13:20:25
also you need to use LEN(MyDateColumn)>8 if you're looking for dd/mm/yyyy ... formats. ISDATE() is not fully reliable. it returns 1 even for year alone values.
Go to Top of Page
   

- Advertisement -