Str_to_date

Hi, I’m trying to convert an existing field in a MySQL table, of type varchar, to date
I’m enclosing the following in a cfquery but it’s throwing an error ‘Incorrect datetime value: ‘Adult’ for function str_to_date’

    UPDATE pupils    
    SET new_birthdate = STR_TO_DATE(birthdate,'%d/%m/%Y');  

Is there a better / alternative way to do this?

Adult is a value in the column? Just add a where clause which restricts the query to rows which can be converted to a date, dunno the name of the SQL function, something like IS_DATE(birthdate)

Hi Zac

Ugh, somehow ‘Adult’ crept into one of the rows instead of a valid date. I’ll take it out!