How to set encoding parameter for SQL Server Bulk statement?

I wrote this SQL Server Bulk script:

BULK INSERT dbo.test
   FROM 'd:\1.csv'
   WITH(
        FIELDTERMINATOR =','

      );

But my CSV file must be encoded using this encoding system:

Encoding.GetEncoding(1256)

How can I apply the code to this bulk script?

+4
source share
1 answer

CodePage is what you are looking for. You may also need a set of RowTerminator values.

BULK INSERT dbo.test
FROM 'd:\1.csv'
WITH(
    FIELDTERMINATOR = ',',
    ROWTERMINATOR = '\n',
    CODEPAGE = '1256'
  );
+2
source

All Articles