简体   繁体   中英

Data migration from SQL Server to Postgres

Using SQLLINES I am trying to migrate from SQL Server to Postgres. http://www.sqlines.com/home

My problem is that the data once migrated (type nvarchar in SQL Server) is translated to text or varchar in Postgres and the data itself is impacted.

Example source data: ordertask

Target data

:o\000r\000d\000e\000r\000t\000a\000s\000k\000

the \\000 is added automatically to all varchar data after each character.

Any help?

The string you see with the \\000 's is simply the string you want, but it is encoded in UTF-16LE, Windows' default character encoding, which is not supported by PostgreSQL.

You could store UTF-16LE-encoded strings in PostgreSQL as byte arrays, but you would lose all text manipulation functions which you probably need.

You should use one of many tools to convert from UTF-16LE to UTF-8 (PostgreSQL preferred encoding) before passing the strings to postgreSQL (on a linux command line, I would use iconv or recode ; your mileage may vary). Another option is to use a client which does the conversion for you (probably all Windows-based clients do).

您可以尝试从https://www.spectralcore.com/fullconvert进行完全转换。它可以很好地处理所有问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM