Bulk Import In Sql Server 2008 from csv/text file

Step 1> Create Table

CREATE TABLE Test
(ID INT,
FirstName VARCHAR(40),
LastName VARCHAR(40))

Step 2>
 Create a CSV or Txt file

1,Pankaj,pandey
2,Rahul,Pandey
3,Ramesh,Mishra
4,Raja,Singh

Step 3> Write given query with change path where your file is saved..

BULK
INSERT Test
FROM 'D:\test.csv'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)

Step 4>  check the data...

select * from Test 

If ok then like or comment on this post.
Ebook Download
View all
Learn
View all