Lisa
Lisa

Reputation: 3181

How to insert data from text file into my table?

I have text files which contain one word per line, and I would like to add this content to a column in my table, the column type is Varchar, how can I accomplish that?

Upvotes: 1

Views: 7504

Answers (2)

hallie
hallie

Reputation: 2845

You can also use import wizard provided in the management studio. You can check this link for your reference.

Upvotes: 0

Mark Byers
Mark Byers

Reputation: 837946

You can treat your file as a special case of CSV - it's a CSV file with only one column.

See this article for how to bulk insert from a CSV file.

BULK
INSERT CSVTest
FROM 'c:\csvtest.txt'
WITH
(
    FIELDTERMINATOR = ',',
    ROWTERMINATOR = '\n'
)
GO

Upvotes: 2

Related Questions