DotNet Mirror
  DNM facebook   DNM Google+   DNM Twitter   

Bulk import in SQL Server 2008 from CSV file

By Maram Kiran Kumar on 15 Apr 2013 | Category: SQL Server | Tagged: Bulk import SQL Server CSV file 
  Discuss Add Comment   |  
Add rating Rate this resource   

Bulk import in SQL Server 2008 from CSV file

First a create table in Sql server 
CREATE TABLE BulkImport
(
ID INT,
Col1 VARCHAR(40),
Col2 VARCHAR(40))
Next Create a CSV file and save as BulkImportTest.csv in your D: drive
1,Row1Col1,Row1Col2
2,Row2Col1,Row2Col2
3,Row3Col1,Row3Col2
4,Row4Col1,Row4Col2
5,Row5Col1,Row5Col2
6,Row6Col1,Row6Col2

copy following query with change path where your file is saved..
BULK
INSERT BulkImport
FROM 'D:\BulkImportTest.csv'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)
now check the imported data...
select * from BulkImport
  Discuss Add Comment    
Add rating Rate this resource   
About the Contributor
Member Since : 31 Dec 2012
Member Points (Level) : 204  (Newbie)
Location : INDIA
Home Page : http://blog.kiranthidesigners.com/p/about-me_25.html
About :
Rate this resource
 
Add your Comment
Name Email WebSite
Captcha Refresh


Comments (0)
No comments found, click here to add comment.
 
cheap jordans|wholesale air max|wholesale jordans|wholesale jewelry|wholesale jerseys