Here is my table definition:
CREATE TABLE BillTexts
(
SessionNum INT,
Name VARCHAR(200),
Part INT,
BillText VARCHAR(MAX)
)
Here is the code I am using to bulk insert it. I have used the funky delimiters to make sure there are no conflicts (commas, newlines) with what's inside the billtext column.
BULK INSERT BillTexts
FROM texts.csv
WITH (
DATAFILETYPE = 'char',
FIELDTERMINATOR = '¬',
ROWTERMINATOR = '[]{}\r\n'
)
Here is the first couple of lines of my text file.
112¬hconres1¬1¬"A whole bunch of text"[]{}
112¬hconres1¬2¬"Another whole bunch of text"[]{}
On every line (including lines 1 through 10) I get the error
Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 1, column 1 (SessionNum)
Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 2, column 1 (SessionNum)
I honestly have no idea why it's failing to insert. As far as I know this is the only way I can get this data into the table (there is a lot of it).
¬character is probably representation oftab. Try\tinstead. - Alex Kudryashev