MySQL Forums
Forum List  »  Newbie

Re: Null values are replaced with zeros in infile.
Posted by: Devart Team
Date: December 09, 2011 09:17AM

...try this one -

LOAD DATA LOCAL INFILE 'C:/orders.csv'
INTO TABLE `order`
FIELDS TERMINATED BY ','
ESCAPED BY '\'
LINES TERMINATED BY '\n' IGNORE 1 LINES
(row_id,
cust_name,
Addr,
item_name,
@var1,
@var2
)
SET order_value = IF(@var1 = '', NULL, @var1),
SET quantity = IF(@var2 = '', NULL, @var2)

Devart Company,
MySQL management tools
http://www.devart.com/dbforge/mysql/

Options: ReplyQuote


Subject
Written By
Posted
Re: Null values are replaced with zeros in infile.
December 09, 2011 09:17AM


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.