I am trying to ingest the following .txt file with content
2|Jürgen
3|Jürgen
4|Jürgen
delimited by |
. The 2nd column is accented letters, as I want to test sql table preserving accented letters.
The sql table to be ingested are defined as
CREATE TABLE [stage].[bcp_test](
[ID] [int] NOT NULL,
[TERM] [nvarchar](100) COLLATE SQL_Latin1_General_CP1_CS_AS NOT NULL)
If I do a simple insertion, insert into stage.bcp_test values(1,'Jürgen')
I can see the accent Jürgen preserved in the table.
But when I tried to insert the 3 rows in the sample file through bcp
bcp stage.bcp_test in "test.txt" -S dbservername -c -t "|" -T -F 1 -b 20000 -m 1 -e error.txt
Jürgen becomes J├╝rgen.
Based on some suggestions, I change -c to -t. So the new bcp command becomes
bcp stage.bcp_test in "test.txt" -S dbservername -w -t "|" -T -F 1 -b 20000 -m 1 -e error.txt
However, 0 rows are copied without any error message.
Is there anything that I missed? I tried to search different places but cannot find a solution. Is it okay for me to bcp a .txt file using bcp -w?
=========================== Regarding Pa1's suggestion,what I got in my sql server is as follow:
Slightly different from his post, maybe because of sql version?
My Sql Server Version:
Microsoft SQL Server 2016 (SP2) (X64)
===========
Add on: Pa1's solution works. Depends on how the file is encoded.