3

I need to take rows from a text file and insert into a table. The rows of the file are similar to the following:

string1
string2
string3
string4
...

My table has 2 columns:

uniqueidentifier, stringValue

I would like to do a bulk insert into the table grabbing each row from the text file and adding a new uniqueidentifier to each one (ideally a GUID, but an integer counter would be fine).

Anyone have a tip on how to do this bulk upload? So far my SQL is:

BULK
INSERT tableNameToInsertInto
FROM 'C:\importList.txt'
WITH
(
ROWTERMINATOR = '\n'
)
GO
4

1 に答える 1