Bluehost.com Web Hosting $6.95

Auto_Increment Issue

This is a discussion on Auto_Increment Issue within the MySQL Database forums, part of the Database Forums category; Hello, my understanding was that LOAD INFILE worked similar to INSERT, AUTO_INCREMENT should take care of my id column. Fields ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-01-2007
Zefarin
 
Posts: n/a
Default Auto_Increment Issue

Hello, my understanding was that LOAD INFILE worked similar to INSERT,
AUTO_INCREMENT should take care of my id column. Fields here are
delimited by @. If I do not include the leading @ then the data loads
offset with month trying to fill "id". But WITH the leading @ the data
imports correctly as far as I can tell but I receive this error after
LOAD INFILE ...

1366 Incorrect integer value: " for column 'id' at row 1

and again for each row thereafter.

my data looks like:

@"2007-01-01"@3@"BBHORU"@"LAM"@"CF PLAID 8 X 11 TALL"@"RED"@"STPLD"@
1@8.75@6.25

and table structure:

CREATE TABLE `esas`.`lineitems` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`month` DATE NOT NULL DEFAULT 0,
`item` VARCHAR(5) NOT NULL DEFAULT '',
`dsc` VARCHAR(6) NOT NULL DEFAULT '',
`vendor` VARCHAR(3) NOT NULL DEFAULT '',
`description` VARCHAR(40) NOT NULL DEFAULT '',
`attr` VARCHAR(15) DEFAULT '',
`size` VARCHAR(15) DEFAULT '',
`qty` INTEGER NOT NULL DEFAULT 0,
`price` FLOAT NOT NULL DEFAULT 0,
`cost` FLOAT NOT NULL DEFAULT 0,
PRIMARY KEY (id)
)
ENGINE = InnoDB;

The actual LOAD syntax I used:

LOAD DATA LOCAL INFILE '~/app/csv_files/rpli0701b.csv'
INTO TABLE lineitems
FIELDS TERMINATED BY '@'
ENCLOSED BY '"'
IGNORE 1 LINES;

The actual data loaded into the table looks fine but I am afraid
to go too much further with this error as I have about fifty files to
LOAD. Should I be worried?

--Zef
Reply With Quote
  #2 (permalink)  
Old 03-01-2007
Zefarin
 
Posts: n/a
Default Re: Auto_Increment Issue

On Thu, 01 Mar 2007 10:21:07 -0800, Zefarin <Zefarin@notlikely.com>
wrote:

Answering my own question. Place the keyword NULL before the leading
delimiter, @.

--Zef

>Hello, my understanding was that LOAD INFILE worked similar to INSERT,
>AUTO_INCREMENT should take care of my id column. Fields here are
>delimited by @. If I do not include the leading @ then the data loads
>offset with month trying to fill "id". But WITH the leading @ the data
>imports correctly as far as I can tell but I receive this error after
>LOAD INFILE ...
>
>1366 Incorrect integer value: " for column 'id' at row 1
>
>and again for each row thereafter.
>
>my data looks like:
>
>@"2007-01-01"@3@"BBHORU"@"LAM"@"CF PLAID 8 X 11 TALL"@"RED"@"STPLD"@
>1@8.75@6.25
>
>and table structure:
>
>CREATE TABLE `esas`.`lineitems` (
> `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
> `month` DATE NOT NULL DEFAULT 0,
> `item` VARCHAR(5) NOT NULL DEFAULT '',
> `dsc` VARCHAR(6) NOT NULL DEFAULT '',
> `vendor` VARCHAR(3) NOT NULL DEFAULT '',
> `description` VARCHAR(40) NOT NULL DEFAULT '',
> `attr` VARCHAR(15) DEFAULT '',
> `size` VARCHAR(15) DEFAULT '',
> `qty` INTEGER NOT NULL DEFAULT 0,
> `price` FLOAT NOT NULL DEFAULT 0,
> `cost` FLOAT NOT NULL DEFAULT 0,
> PRIMARY KEY (id)
>)
>ENGINE = InnoDB;
>
>The actual LOAD syntax I used:
>
>LOAD DATA LOCAL INFILE '~/app/csv_files/rpli0701b.csv'
>INTO TABLE lineitems
>FIELDS TERMINATED BY '@'
>ENCLOSED BY '"'
>IGNORE 1 LINES;
>
>The actual data loaded into the table looks fine but I am afraid
>to go too much further with this error as I have about fifty files to
>LOAD. Should I be worried?
>
>--Zef

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 05:20 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0