Bulk inserting multiple text files to create Lookup tables in a database using Sql Server 2012 Developer.
Able to successfully load one set of lookup tables, the ones with a blank space delimiter.
However, I encounter an error when I attempt to load the second set of text files that contain a tab delimited delimiter.
Specifically, it appears that the red error lines appear underneath the line "FIELDTERMINATOR = ' \t'"
with the error message "Incorrect syntax."
Is it recommended or even good practice to use bulk import to load multiple text files with different field delimiters using the same sql script?
Any insight as to how the example sql script below should be formatted so that the error is eliminated?
Able to successfully load one set of lookup tables, the ones with a blank space delimiter.
However, I encounter an error when I attempt to load the second set of text files that contain a tab delimited delimiter.
Specifically, it appears that the red error lines appear underneath the line "FIELDTERMINATOR = ' \t'"
with the error message "Incorrect syntax."
Is it recommended or even good practice to use bulk import to load multiple text files with different field delimiters using the same sql script?
Any insight as to how the example sql script below should be formatted so that the error is eliminated?
Code:
CREATE TABLE LU_Equipment(Data VARCHAR (50),MoreData varchar(50))
BULK INSERT LU_Equipment FROM 'c:\Equipment.txt'
WITH (
FIELDTERMINATOR = " ",
ROWTERMINATOR = '\n',
FIRSTROW = 2
)
CREATE TABLE LU_Supplies(Data VARCHAR (50),MoreData varchar(50))
BULK INSERT BULKACT FROM 'c:\Supplies.txt'
WITH (
FIELDTERMINATOR = ' \t',
ROWTERMINATOR = '\n',
FIRSTROW = 2
)