MySQL Forums
Forum List  »  MySQL Workbench

Importing CSV with NULL values to a Table
Posted by: kenneth dyson
Date: June 05, 2018 11:17AM

I am using the "Table Data Import Wizard" to input a csv file containing columns of number data.
Some cells are NULL, and have in them the characters NULL.
When I start the wizard all the "Field Types" are given as "text", and I can see the NULL entries in the preview pane.
I then change them to "int" or "double". and
I have the "Encoding" at utf-8.
I then run through the rest of the wizard.
The imported data no longer has the NULL data, all the rows with any NULL values were dropped.

If I import with all the "Fields Types" set to "text" I get all the rows, but then I can't treat the values as numbers for operations in MySQL, correct?

I tried changing the "Field Types" to "int" or "double" after importing as "text" but was greeted with errors:
ALTER TABLE tablename MODIFY columnname INTEGER;
Error Code: 1265. Data truncated for column 'columnname' at row 1 0.024 sec

Any ideas as to what I should do?
Thanks

Options: ReplyQuote


Subject
Views
Written By
Posted
Importing CSV with NULL values to a Table
49
June 05, 2018 11:17AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.