Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a CSV file with a semi colon delimiter to upload in MySQL db

Status
Not open for further replies.

dbuuch

IS-IT--Management
Dec 15, 2003
17
US
Hi there,

I am trying to create a CSV file with a semi colon (;) delimiter instead of the usual commas but don't know how.

My original file is an Excel spreadsheet and when i use the 'save as' option it uses commas as the delimiter and does not give me the option to change to semi colons.

i tried to open the excel cvs file in notepad and then replaced all the commas with semi colons and then saved it with the .csv file extension but i am still getting errors and so unable to upload.

Is there any other way out? Also, my instructions say i should make sure that my csv file is compatible with UNIX encoding and that the line break must be made with LF key combination.

how can I, with an ordinary mind, do all these?

Any help?

thanks to you all great minds.

Buuch

"To educate a man is to educate an individual; to educate a woman is to educate a nation"
Dr. Aggrey, Ghana.
 
If you're creating the file on a DOS-based computer, you should be able to run dos2unix on the Unix system after copying the file to it.

The main thing is to know what kind of errors you're getting, and exactly what you mean by "upload" in this context.
 
Why do you want semicolons instead of commas? If you're planning to import the file into MySQL, then it doesn't matter which you use. It also doesn't matter what line-endings you use. Your import SQL might look something like:
[tt]
LOAD DATA LOCAL INFILE 'filepath'
INTO TABLE tablename
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\r\n'
[/tt]
 
Thanks guys, much appreciated. I know Access and Oracle dbs but new to MySQL. i am using a webdatabase tool to create a simple database for my club members. This tool is supplied by my hosting company and i was trying to use one of their templates to create the database. The tool requires the file to be delimited by semicolons.

I will probably try and create the db from scratch without the template and then try with your SQL to see if this solves the problem.

Thanks guys,
Buuch


"To educate a man is to educate an individual; to educate a woman is to educate a nation"
Dr. Aggrey, Ghana.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top