i am trying to find the some bad data which is not properly formatted for date columnsthe column is Varchar(8) and has value like '06011984'. i know how to convert it into a datetime but there are some bad dates in there. how do i find the bad datesi.e.: bad date '04100213' instead of '04102013'i would use CONVERT(datetime,RIGHT(DATE,4)+LEFT(DATE,2)+SUBSTRING(DATE,3,2))
i am using a query like this but it lists me all the records in the table, even the good onesselect * from table where date not like '[0-1][0-9][0-3][0-9][19-20][0-1][0-9]'