I am trying to modify the data type for the column 'observacion' (seventh row in the first image) from VARCHAR to TEXT with the following code:
cursor = conn.cursor()
sql ='''ALTER TABLE requerimientos
MODIFY observacion TEXT'''
cursor.execute(sql)
conn.close()
But I am getting the following error: "DataError: 1292 (22007): Incorrect date value: '0000-00-00' for column 'fecha' at row 6", You can see in the bottom right of the next image the "Incorrect Value" that is causing the error. The problem is that the error corresponds to another column and it is not the one that I am trying to modify.
CodePudding user response:
you should follow this structure
ALTER TABLE table_name ALTER COLUMN column_name datatype;
CodePudding user response:
Solved it by replacing all the NULL values in the column 'fecha' (which is the one that was causing me trouble) with a date, then I was able to change the datatype of the column 'observacion' as I initially intended