sql server批量复制/postgres从infile复制

发布于 2024-09-05 13:23:33 字数 550 浏览 2 评论 0原文

我正在开始将系统从 MS SQL Server 转换为 Postgres。我转换了表结构,并使用“bcp”从 SQL Server 中获取数据。

ERROR:  invalid byte sequence for encoding "UTF8": 0x80
HINT:  This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding".
CONTEXT:  COPY cm_outgoing, line 200: "200  c:\temp\200.xml 2009-10-10 01:50:44.000 1900-01-01 00:00:00.000"

我已经使用“sed”来删除文件中的 NUL (0x00) 条目,但在我尝试导入的文件中找不到任何 0x80 的实例。

有什么想法吗?有更简单的方法吗?

I'm starting a conversion of a system from MS SQL Server to Postgres. I have the table structures converted, and I use "bcp" to get the data out of SQL Server.

ERROR:  invalid byte sequence for encoding "UTF8": 0x80
HINT:  This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding".
CONTEXT:  COPY cm_outgoing, line 200: "200  c:\temp\200.xml 2009-10-10 01:50:44.000 1900-01-01 00:00:00.000"

I've already used "sed" to get rid of the NUL (0x00) entries in the file, and I can't find any instances of 0x80 in the file that I'm trying to import.

Any thoughts? Is there an easier way?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

蓝眼睛不忧郁 2024-09-12 13:23:33

看起来问题出在 windows 路径上。我不知道我们是如何到达 0x80 的,但是加倍反斜杠是有效的。

looks like the trouble was in the windows paths. I'm not sure how we got to 0x80, but doubling the backslashes worked.

云仙小弟 2024-09-12 13:23:33

你的数据真的是UTF8吗?您是否尝试过将 postgresql 客户端中的 client_encoding 设置为类似 Latin1 的值?

set client_encoding = 'latin1';
--do your COPY here

Is your data really UTF8? Have you tried setting the client_encoding in your postgresql client to something like Latin1 ?

set client_encoding = 'latin1';
--do your COPY here
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文