Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training

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.

Ads

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        |
+--------+----------+-----------+

Advertisements

Ads
Share on Google+Share on Google+

SQL Bulk Insert csv

Posted on: January 20, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

Ads
 

Discuss: SQL Bulk Insert csv   View All Comments

Post your Comment


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

Ads

 

Ads