I have this little sql script to import a semicolon separated file into a specific table of my database:
BULK
INSERT foo_bar
FROM 'C:\Users\JohnDoe\projects\foo\ftp-data-importator\bar.txt'
WITH
(
FIELDTERMINATOR = ';',
ROWTERMINATOR = '\n',
FIRSTROW = 2,
MAXERRORS = 100000,
ERRORFILE = 'c:\temp\foobar_bulk_log.txt'
)
GO
And it's working like a charm. The only problem is that some special unicode characters like ó or é are not being inserted respecting the encoding of the file.
So I added the next line between the WITH keyword parentheses:
DATAFILETYPE = 'widenative'
And instead of respecting the encoding is breaking the whole execution and giving me the next error:
Msg 4866, Level 16, State 5, Line 5 The bulk load failed. The column is too long in the data file for row 1, column 1. Verify that the field terminator and row terminator are specified correctly. Msg 7301, Level 16, State 2, Line 5 Cannot obtain the required interface ("IID_IColumnsInfo") from OLE DB provider "BULK" for linked server "(null)".
Where is the problem?
DATAFILETYPE = 'widenative'withCodePage=1252. Post the comment as answer if you want. You were aiming in the right direction. - VictorArcas