I have a flat file witch I would like to bulk insert into SQL server (2016).
BULK INSERT table FROM 'path\flatfile.dat'
WITH
(
FORMATFILE='path\fileformat.fmt',
CODEPAGE = '65001',
DATAFILETYPE = 'Char'
);
Flat file has no field terminator:
9999030000000001001ab Baujahr 0
9999030000000001004from construction year 0
9999030000000001006à partir d'année de construction 0
9999030000000001007da anno 0
9999030000000001008año construcción desde 0
9999030000000001009Vanaf bouwjaar 0
9999030000000001010fra byggeår 0
9999030000000001011från årsmodell 0
9999030000000001012fra årsmodell 0
9999030000000001013Vuosimallista 0
but in format file I set the lenght of field
12.0
7
1 SQLCHAR 0 22 "" 1 Field1 ""
2 SQLCHAR 0 4 "" 2 field2 ""
3 SQLCHAR 0 3 "" 3 field3 ""
4 SQLCHAR 0 9 "" 4 field4 ""
5 SQLCHAR 0 3 "" 5 field ""
6 SQLCHAR 0 60 "" 6 Textfield ""
7 SQLCHAR 0 1 "\r\n" 7 flag ""
The other files I have with similar format works great except this one. The error I'm getting is truncation of rows which contains caracters áåóñ...
Msg 4863, Level 16, State 1, Line 6
Bulk load data conversion error (truncation) for row 3, column 7 (LFlag).
Msg 4863, Level 16, State 1, Line 6
Bulk load data conversion error (truncation) for row 5, column 7 (LFlag).
Msg 4863, Level 16, State 1, Line 6
Bulk load data conversion error (truncation) for row 7, column 7 (LFlag).
Msg 4863, Level 16, State 1, Line 6
any ideas ?