user793468
user793468

Reputation: 4976

bulk insert into temp table from a text file

is there a way to bulk insert a text file content into a SQL temp table?

I want to insert each row in a text file into separate rows in the SQL Temp Table. What is the best way of doing this?

Upvotes: 1

Views: 4548

Answers (1)

Rahul
Rahul

Reputation: 77926

Use the SQL Server BULK INSERT command. Though it depends on data format in file but at a simplest example; if your file has data like below and file name is data.txt

Kelly, Reynold, kelly@reynold.com 

Then the command should look like

BULK INSERT temp_table FROM 'D:\data.txt' WITH (FIELDTERMINATOR = ',');

Upvotes: 2

Related Questions