I have a table with lots of records. My table has the following field, with records containing either NULL or '1' that I need to modify.
archived int(1) unsigned DEFAULT NULL
But I need to modify it so that it is NOT NULL and defaults to '0'. I have tried the following but it throws an error.
-- Error "#1265 - Data truncated for column 'archived' at row 1"
archived INT( 1 ) UNSIGNED NOT NULL DEFAULT '0'
I need to modify the table so that the records that are NULL for that field, will be updated to '0'. I need the records that are currently '1', to retain that value.
SET archived = 0
WHERE archived IS NULL
Thank you - that is a good solution.