Will import first column, but not the rest

[expired user #6521]'s profile image [expired user #6521] posted 12 years ago in Import/Export Permalink
When I first started using this program today, HeidiSQL only imported the first column and gave several errors that the value of the first column wasn't long enough. It did order the data in the correct rows. Now it only created three rows and added random data into two of the three columns. What am I doing wrong?
jfalch's profile image jfalch posted 12 years ago Permalink
When you first started using this program today, what exactly did you DO ? Did you try to import a .csv file into an existing table, or what ? and if so, what are the characters that separate fields in the csv file ? how many fields have the liens in the .csv file, how many fields has the table ?
[expired user #6521]'s profile image [expired user #6521] posted 12 years ago Permalink
I imported into a table that existed, but was empty. What characters do I need to separate fields? Do I add them in every cell or at the end of every column?
jfalch's profile image jfalch posted 12 years ago Permalink
what kind of file are you trying to import into heidisql ?
[expired user #6521]'s profile image [expired user #6521] posted 12 years ago Permalink
CSV file. One spreadsheet has airport information, the other FBO.
jfalch's profile image jfalch posted 12 years ago Permalink
when you export .csv files from excel (or etc) by using "save as" with file type csv, the cell values are stored as adjacent fields in the resulting text file, one row per line. To separate these fields, excel usually uses a semicolon. cf rfc4180 for details; note that special care is necessary if any of the cell values should contain a double quote (") or semicolon character.

when using the "import csv file..." tool from heidiĀ“s menu, the following dialog has a panel named "control characters" in the upper right. Specify here the characters actually used in your file; with excel, its usually
"fields term by" = ;
"fields encl by" = "
"fields esc by" = \
"lines term by" = \r\n
if the file should contain as first line a header line with field (=column) names, also set "ignore first" to 1 on the upper left.

does this work ? if not, please post the first two lines from your airport file.
jfalch's profile image jfalch posted 12 years ago Permalink
PS you can open the .csv file with any editor (e.g. notepad) to see its contents as heidisql sees them.
jfalch's profile image jfalch posted 12 years ago Permalink
PS2: if the order of the fields in the database table (shown in the bottom right panel "Destination") should be different from the order of the fields in your .csv file, you must also first reorder the fields in this panel, using drag&drop, so that the resulting order of fields parallels that in the file.
[expired user #6521]'s profile image [expired user #6521] posted 12 years ago Permalink
ID ICAO FAAorIATA
101 KACK ACK
585 KAPF APF

This is a small example of the spreadsheet.

ID, ICAO, FAAorIATA
101,KACK, ACK
585,KAPF, APF

This is how heidisql sees it

What character's do I need and where should they be placed for heidisql to read this correctly?

jfalch's profile image jfalch posted 12 years ago Permalink
"fields term by" in import dialog must be set to comma (,), not semicolon, since that is what separates the three fields in your csv file.
jfalch's profile image jfalch posted 12 years ago Permalink
PS all characters have already been placed correctly in your csv fiel by excels "save as" function. you only have to tell heidisql about them via the import dialog.

Please login to leave a reply, or register at first.