Monday, 21 May 2012
 Home arrow Articles arrow mysql arrow Import CSV file directly into MySQL
   
Main Menu
Home
News
Blog
Links
Search
FAQs
Spider
Articles
@intrenet
Free Softwares
Break for fun
Friends VIdeos
Techno videos
Contact Us
Disclaimer
Guest Book
Speed test
V.E.C. Calculator
IPv4 Subnet Calc
IPv6 Subnet Calc
Byte Converter
Converter
GMT/UTC Time
Bandwidth Calc
Allinone Calc
IANA Port Numbers
Country Call Codes
Pk Postal Codes
Surf Anonumously
Visitors Counter
mod_vvisit_countermod_vvisit_countermod_vvisit_countermod_vvisit_countermod_vvisit_countermod_vvisit_countermod_vvisit_counter
mod_vvisit_counterToday121
mod_vvisit_counterYesterday203
mod_vvisit_counterThis week121
mod_vvisit_counterThis month4670
mod_vvisit_counterAll125346
 
 
 
 


Import CSV file directly into MySQL PDF Print E-mail
User Rating: / 0
PoorBest 
Written by Amanatullah khalil   
Sunday, 24 May 2009

Import CSV file directly into MySQL

 

Instead of writing a script to pull in information from a CSV file, you can link MYSQL directly to it and upload the information using the following SQL syntax.


To import an Excel file into MySQL, first export it as a CSV file. Remove the CSV headers from the generated CSV file along with empty data that Excel may have put at the end of the CSV file.

You can then import it into a MySQL table by running:

load data local infile 'uniq.csv' into table tblUniq
fields terminated by ','
enclosed by '"'
lines terminated by '\n'
(uniqName, uniqCity, uniqComments)

The fields here are the actual tblUniq table fields that the data needs to sit in. The enclosed by and lines terminated by are optional and can help if you have columns enclosed with double-quotes such as Excel exports, etc.

courtesy http://www.tech-recipes.com/rx/2345/import_csv_file_directly_into_mysql/

 
< Prev
 
 
 
csatpk Newsflash
Statistics
OS: Linux h
PHP: 5.2.17
MySQL: 5.1.63-community-log
Time: 21:06
Caching: Disabled
GZIP: Disabled
Members: 3
News: 368
Web Links: 5
Visitors: 265572
Popular