Supported conversions. Supported conversions between different but similar data types are
shown in the following list:
• Between any of the integer types TINYINT, SMALLINT, MEDIUMINT, INT, and BIGINT.
This includes conversions between the signed and unsigned versions of these types.
Lossy conversions are made by truncating the source value to the maximum (or minimum) permitted
by the target column. For insuring non-lossy conversions when going from unsigned to signed types,
the target column must be large enough to accommodate the range of values in the source column.
For example, you can demote TINYINT UNSIGNED non-lossily to SMALLINT, but not to TINYINT.
• Between any of the decimal types DECIMAL, FLOAT, DOUBLE, and NUMERIC.
FLOAT to DOUBLE is a non-lossy conversion; DOUBLE to FLOAT can only be handled lossily. A
conversion from DECIMAL(M,D) to DECIMAL(M',D') where M' = M and D' = D is non-lossy;
for any case where M'
(…)
… Section 12.19.4, “Rounding Behavior”, for information about how this is done for
decimal types.
• Between any of the string types CHAR, VARCHAR, and TEXT, including conversions between different
widths.
Conversion of a CHAR, VARCHAR, or TEXT to a CHAR, VARCHAR, or TEXT column the same size or
larger is never lossy. Lossy conversion is handled by inserting only the first N characters of the string
on the…
... zobacz całą notatkę
Komentarze użytkowników (0)