-1

I am trying to bulk insert a data file into a SQL table. The data files structure is:

Col1FSCol2FSCol3
Val1FSVal2FSVal3

FS is a control character (File Separator), corresponding to Byte 1C.

However, the following bulk insert code in SQL does not work:

bulk insert schema.table
from 'filepath'
with (
  datafiletype = 'char'
, codepage = 'ACP'
, firstrow = 2
, fieldterminator = '0x1C'
, rowterminator = '\n'
, tablock
)
jarlh
  • 42,561
  • 8
  • 45
  • 63
Orsinus
  • 379
  • 5
  • 11

1 Answers1

0

We just solved the problem: If fieldterminator is specified in Hex-Notation, rowterminator also has to be specified in Hex-Notation.

Therefore, the solution is:

 bulk insert schema.table
from 'filepath'
with (
  datafiletype = 'char'
, codepage = 'ACP'
, firstrow = 2
, fieldterminator = '0x1C'
, rowterminator = '0x0A'
, tablock
)
Orsinus
  • 379
  • 5
  • 11