If you can't fix the import script then you should be able to use a trigger to patch things up before INSERTs or UPDATEs get to the table. Something like this should do the trick:
delimiter $$
create trigger nullify_blanks_ins before insert on your_table
for each row begin
if new.string = '' then
set new.string = null;
end if;
end;
$$
create trigger nullify_blanks_upd before update on your_table
for each row begin
if new.string = '' then
set new.string = null;
end if;
end;
$$
delimiter ;
new
here refers to what the row will look like after the INSERT or UPDATE completes so you can look for the garbage values and fix them. Then, since these are BEFORE triggers, your patched rows will go into the database. You would, of course, have to change the table (your_table
) and column (string
) names to suit your situation.