Computing.Net > Forums > Database > SQL and CSV file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

SQL and CSV file

Reply to Message Icon

Name: PCgeek
Date: February 24, 2007 at 16:04:23 Pacific
OS: WinXp Pro
CPU/Ram: 512
Product: Dell Aus.
Comment:

I have made a database and want to import a *.csv file to create records. Now I know PHPMyadmin will do this but when i select the CSV option under import and try to import i get an error saying that the file is invalid.

I made sure the different signs are correct before importing (on the import page). I created the file in excel and saved as a csv.

Please Help

Tim



Sponsored Link
Ads by Google

Response Number 1
Name: srobert
Date: March 19, 2007 at 19:17:31 Pacific
Reply:

If you are one of the many people trying to import a CSV file into MySQL using mysqlimport under MS-Windows command/DOS prompt, try the following:

mysqlimport --fields-optionally-enclosed-by=""" --fields-terminated-by=, --lines-terminated-by="\r\n" --user --password DATABASE 1.csv

BTW, you can export one CSV file using PHPMyadmin, then open it, you can find what format that PHPMyadmin need.

good luck.


0

Response Number 2
Name: JanetKellman
Date: July 9, 2007 at 13:25:22 Pacific
Reply:

Keep in mind that your imported text file should
have some value for empty fields. I regularly
build tables using msqlimport to import
tab-delimited text files. My tables contain
integer fields, some of which are
auto_incremented and some are not. MYSQL will
let you represent empty fields as null text
strings, i.e., two tab characters back-to-back,
but I found this increments the warning count.
To solve this problem you must use some value
for empty fields. Since auto_increment fields
use 0 or NULL, one would think, incorrectly,
that you could use 0 or \N to represent a null
value in the import text file. You must 0 for
an auto_increment field. Using \N increments
the warning count. You should use \N for other
numeric fields where you want a null value.
This problem is especially perplexing because of
MySQL's inability to report the text of a
warning. It only reports a warning count.

software reviews


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Database Forum Home


Sponsored links

Ads by Google


Results for: SQL and CSV file

SQL, Database, and RDBMS questions www.computing.net/answers/dbase/sql-database-and-rdbms-questions/717.html

Importing .CSV www.computing.net/answers/dbase/importing-csv/308.html

tricky sql loop www.computing.net/answers/dbase/tricky-sql-loop/253.html