Suppress CAST() warnings in MySQL?

I'm assuming the problem is that you are trying to insert data from one table into another using a query like this:

INSERT INTO ...
SELECT ...
FROM ...
WHERE ...
ORDER BY ...

And the inserts are failing because of the CAST() problem you described in your question.

Is that accurate?

If so, the easiest way around this is to use INSERT IGNORE. That syntax is useful for ignoring duplicate key errors, but it can also be used to ignore the CAST() errors that are affecting you.

Your updated query would look something like this:

INSERT IGNORE INTO target_table
SELECT ...
FROM source_table
WHERE ...
ORDER BY CAST (StreetNr AS SIGNED), StreetNr

Tags:

Mysql