selecting values of date

In a table, date is stored in a column as "2011-01-4".
If I write query to get the dates > "2011-01-06" , then the date "2011-01-4" is also listed. The date stored in the column is a varchar datatype. So how can I make a query to not display the date "2011-01-4" ? Is there any solution ? Thank You.........

Junky data - 0 in month but not in day. Maybe, update all such to put the zero back!

You can extract the digits of year, month and day and add them back together: Y*10000+m*100+d as an integer, and then they compare fine.

Your DB may have a convert string to date-time type. What DB?

Do you mean Oracle SQL? varchar is a DB datatype.

He didn't say, and I meant a built in RDBMS conversion from varchar to a dateTime to timestamp datatype, on the fly, for comparison.

I solved it by converting with date_format function....Thank You All ! :cool: