Quantcast
Channel: MySQL Forums - MySQL Workbench
Viewing all articles
Browse latest Browse all 3736

Importing from csv, no primary key in csv, auto increment not working (no replies)

$
0
0
Hello,

I am new to MYSQL workbench.

I have a csv file I am trying to import.

I have had it successfully import (sort of)

My data has lots of duplicate data and no one field by itself can serve as a primary key (I can combine some fields if we can't get this working)

I created a field a_id and checked PK, NN, and AI.

I am almost certain I saw the auto-increment work once, but as I am setting things up I have deleted and data and change things and go again -

Now I am getting an error:

ERROR 1366: Incorrect integer value: '' for column 'averaged_historical_forecasts_a_id' at row 1

SQL Statement:

here is "a" workbench generated statement:

INSERT INTO `temperature_forecasts`.`averaged_historical_forecasts_a` (`Read_Date`, `Read_Time`, `Forecast__Date`, `_Forecast_Time_`, `Start_Hour`, `End_Hour`, `Columbia_ACCU-Weather`, `Columbia__NOAA`, `Lewisburg_ACCU-Weather`, `Lewisburg_NOAA`, `Shelbyville_ACCU-Weather`, `Shelbyville_NOAA`, `Manchester_ACCU-Weather`, `Manchester_NOAA`, `Decherd_ACCU-Weather`, `Decherd_NOAA`, `averaged_historical_forecasts_a_id`) VALUES ('2015-02-05', '7:55', '2015-02-05', ' 8:00 - 9:00', ' 8:00', '9:00', '27.5', '26.5', '27.5', '27', '27.5', '28', '27.5', '28', '29.5', '30', '');

I would have thought the INSERT statement would not include the id and notice the comma at the end before the closing parentheses.

Bottom line - I am trying to import from a csv file some data and not have to create a primary key by combine data within the csv and use the auto-increment but I am doing all of this within the workbench environment

Thanks

Viewing all articles
Browse latest Browse all 3736

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>