MySQL Forums :: Newbie :: Null values are replaced with zeros in infile.


Advanced Search

Null values are replaced with zeros in infile.
Posted by: Sudheendra Walvekar ()
Date: December 08, 2011 05:53AM

Hi,

I have been trying to use infile to import data from a csv file into MySQL table.The columns in MySQL table are defaulted to null.

The csv file contains blank or null values in some of the columns. The code looks as below.

LOAD DATA LOCAL INFILE 'C:/orders.csv'
INTO TABLE order
FIELDS TERMINATED BY ','
ESCAPED BY '\'
LINES TERMINATED BY '\n' IGNORE 1 LINES

Though the import is successful, I see zeros instead of blank or Null in the corresponding columns in the table in MySQL. I need the values appearing as Null if the corresponding value in csv file is blank.

I would appreciate any help.

Regards

Sudheendra

Options: ReplyQuote


Subject Written By Posted
Null values are replaced with zeros in infile. Sudheendra Walvekar 12/08/2011 05:53AM
Re: Null values are replaced with zeros in infile. Devart Team 12/08/2011 08:13AM
Re: Null values are replaced with zeros in infile. Sudheendra Walvekar 12/09/2011 08:49AM
Re: Null values are replaced with zeros in infile. Devart Team 12/09/2011 09:14AM
Re: Null values are replaced with zeros in infile. Devart Team 12/09/2011 09:17AM
Re: Null values are replaced with zeros in infile. Sudheendra Walvekar 12/11/2011 01:01AM


Sorry, you can't reply to this topic. It has been closed.

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.