I'm trying to save some ID values from CSV that are automatically converted to exponent numbers by Excel.
Like 382383816413
becomes 3.82384E+11
. So I'm doing a full import into my MySQL database with:
LOAD DATA LOCAL INFILE
'file.csv'
INTO TABLE my_table
FIELDS TERMINATED BY ';'
ENCLOSED BY '"'
ESCAPED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 LINES
(@`item_id`,
@`colum2`,
@`colum3`)
SET
item_id = @`item_id`;
I've tried using cast like:
CAST('3.82384E+11' as UNSIGNED)
and it gives me just 3
.
CAST('3.82384E+11' as BIGINT)
and it doesn't work.
CAST('3.82384E+11' as UNSIGNED BIGINT)
and gives me 3
again.
So, what's the better way to convert string exponent numbers to real big integers in MySQL?