Manual import into SQL Server 2000 of tab delimited text file does not format international characters

StackOverflow https://stackoverflow.com/questions/18135227

문제

I have searched for this specific solution and while I have found similar queries, I have not found one that solves my issue. I am manually importing a tab-delimited text file of data that contains international characters in some fields.

This is one such character: Exhibit Hall C–D

it's either an em dash or en dash in between the C & D. It copies and pastes fine, but when the data is taken into SQL Server 2000, it ends up looking like this:

Exhibit Hall C–D

The field is nvarchar and like I said, I am doing the import manually through Enterprise Manager. Any ideas on how to solve this?

도움이 되었습니까?

해결책

The problem is that the encoding between the import file and SQL Server is mismatched. The following approach worked for me in SQL Server 2000 importing into a database with the default encoding (SQL_Latin1_General_CP1_CI_AS):

  1. Open the .csv/.tsv file with the free text editor Notepad++, and ensure that special characters appear normal to start with (if not, try Encoding|Encode in...)

  2. Select Encoding|Convert to UCS-2 Little Endian

  3. Save as a new .csv/.tsv file

  4. In SQL Server Enterprise Manager, in the DTS Import/Export Wizard, choose the new file as the data source (source type: Text File)

  5. If not automatically detected, choose File type: Unicode (in preview on this page, the unicode characters will still look like black blocks)

  6. On the next page, Specify Column Delimiter, choose the correct delimiter. Once chosen, Unicode characters should appear correctly in the Preview pane

  7. Complete import wizard

다른 팁

I would try using the bcputility ( http://technet.microsoft.com/en-us/library/ms162802(v=sql.90).aspx ) with the -w parameter.

You may also want to check the text encoding of the input file.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top