Inserting Bulk Data in SQL Server from Text file

There is a simple query to do this bulk insert in to sql server from a text file. The thing is that we have to keep a fully formatted text file with appropriate data’s which are to be inserted.

Here, we have a table to be inserted is,

The query for creating table,

CREATE TABLE Employee
(
FName varchar (100) NOT NULL,
LName varchar (100) NOT NULL,
Email varchar (100) NOT NULL
)

Then we have a text file with the bulk data’s like as follows,

vinoth,kumar,itvinoth83@gmail.com
emp1FName,emp1LName,emp1@company.com
emp2FName,emp2LName,emp2@company.com
emp3FName,emp3LName,emp3@company.com
emp4FName,emp4LName,emp4@company.com
emp5FName,emp5LName,emp5@company.com
emp6FName,emp6LName,emp6@company.com
emp7FName,emp7LName,emp7@company.com
emp8FName,emp8LName,emp8@company.com
emp9FName,emp9LName,emp9@company.com
emp10FName,emp10LName,emp10@company.com
emp11FName,emp11LName,emp11@company.com
emp12FName,emp12LName,emp12@company.com

Now the query for inserting bulk data is,

BULK INSERT Employee FROM 'c:\bulktext.txt' WITH (FIELDTERMINATOR = ',')

Now you can see the data's inserted in table by the select query as follows,

select * from Employee

The following image is being explained the above matters.





...S.VinothkumaR.

3 comments:

Vivia said...

YAY!I'm the first to post a comment. I haven't read your post. This is gonna be random but... I just wanted to write to say that I HAVE THE SAmE BACKGROUND!
DON"T EMAIL...OR ELSE!!!!

escort said...

Awesome blog Adam!! deneme linki I saw you all in Buffalo and the show was incredible, antalya pansiyonları the best I've ever seen and I can't wait to see the show again in Rochester! It's so great to hear you're having a good time. eskort met you in Cleveland and you seemed so escort kızlar ankara If things go my way, I'll be able to catch up with chat sitesi toptan mallar satış sitesi toptan satış deneme travesti istanbul
derteg deneme escort bayanlar istanbul If you don't know how to spot the difference, just watch any of the Filipinas buying and you'll soon catch on. izmir jigolo Crab-sexers par excellence, it seems there's nothing these people aren't good at! cinema izle dd

SteveBrad said...

This blog is provide lots of good idea and your blog are very usefull for me.Thanks a lot.
buy Generic Viagra