Home Sql Mysql-example SQL Bulk Insert csv



SQL Bulk Insert csv
Posted on: January 20, 2009 at 12:00 AM
SQL Bulk Insert is used to import the records from csv file to the same format table in a Mysql database.

SQL Bulk Insert csv

     

SQL Bulk Insert is used to import the records from csv  file to the same format table in a Mysql database.

Understand with Example

The Tutorial covers an example from 'SQL Bulk Insert CSV'.To understand and  grasp this example we create a table 'stu' with required fieldnames and datatypes respectively.Again, we create a file abc  with extension csv contain the records that are imported to the table 'stu'.

 

 

 

 

Create Table Stu

Create Table Stu( Id int, Name varchar(15), Class());

abc.csv

1	Komal	10
2	Ajay	10
3	Santosh	10
4	Rakesh	10
5	Bhau	10

Backup query 

The Backup query is used to import a abc.csv file into a table 'stu'.The LOAD DATA INFILE import the file abc.csv to the same format table stu of the database.

LOAD DATA INFILE 'c:/abc.csv' INTO TABLE stu
FIELDS TERMINATED BY '\t'
LINES TERMINATED BY '\n';

Table Stu_Table

+--------+----------+-----------+
| Stu_Id | Stu_Name | Stu_Class |
+--------+----------+-----------+
| 1      | Komal    | 10        |
| 2      | Ajay     | 10        |
| 3      | Santosh  | 10        |
| 4      | Rakesh   | 10        |
| 5      | Bhau     | 10        |
+--------+----------+-----------+

Related Tags for SQL Bulk Insert csv:
sqlmysqlcdatabasefileormtabledataformcsvimportinsertsedformatporttabforrecordbulkrecordstobaseeiluseulimfrominrmcsasmasemesamesatmykisrdsrtsassamssamrdthabablomo


More Tutorials from this section

Ask Questions?    Discuss: SQL Bulk Insert csv   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.