[英]Data migration from SQL Server to Postgres
Using SQLLINES I am trying to migrate from SQL Server to Postgres.使用 SQLLINES 我试图从 SQL Server 迁移到 Postgres。 http://www.sqlines.com/home 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.我的问题是一旦迁移的数据(在 SQL Server 中键入nvarchar
)在 Postgres 中被转换为text
或varchar
并且数据本身受到影响。
Example source data: ordertask
示例源数据: 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. \\000
会自动添加到每个字符后的所有varchar
数据中。
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.您看到的带有\\000
的字符串就是您想要的字符串,但它以 UTF-16LE 编码,这是 Windows 的默认字符编码,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.您可以将 UTF-16LE 编码的字符串作为字节数组存储在 PostgreSQL 中,但是您将丢失所有您可能需要的文本操作函数。
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).在将字符串传递给 postgreSQL 之前,您应该使用众多工具之一从 UTF-16LE 转换为 UTF-8(PostgreSQL 首选编码)(在 Linux 命令行上,我会使用iconv
或recode
;您的里程可能会有所不同)。 Another option is to use a client which does the conversion for you (probably all Windows-based clients do).另一种选择是使用为您进行转换的客户端(可能所有基于 Windows 的客户端都这样做)。
您可以尝试从https://www.spectralcore.com/fullconvert进行完全转换。它可以很好地处理所有问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.