I'm trying to find a way to load a mysql table which I call ipCompare_tbl with IP addresses from a CSV file called myIPs.csv.
The fields in ipCompare_tbl are ipStart, and ipEnd. I've also included an auto_incrementor for a primary key generator field called id.
My goal is to have ipCompare_tbl loaded with:
ipStart ipEnd id
123.10.0.0 123.0.0.255 1
130.20.0.0 130.0.0.255 2
140.30.0.0 140.0.0.255 3
I keep getting the following error: ERROR 1366 (HY000): Incorrect integer value: '"130.20.0.0"' for column 'ipStart' at row 1
I'm running the following code for it:
DROP TABLE IF EXISTS ipCompare_tbl;
CREATE TABLE ipCompare_tbl(
ipStart int(10) unsigned NOT NULL,
ipEnd int(10) unsigned NOT NULL,
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY ( id ));
LOAD DATA INFILE 'myIPs.csv' INTO TABLE ipCompare_tbl
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY ';'
IGNORE 1 LINES;
SELECT INET_ATON(ipStart), INET_ATON(ipEnd)
FROM ipCompare_tbl;