如何将数据从 SQL Server 导出到 PostgreSQL?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24078337/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 01:28:42  来源:igfitidea点击:

How to export data from SQL Server to PostgreSQL?

postgresql

提问by Meem

I need to export all tables from SQL Server to PostgreSQL.

我需要将所有表从 SQL Server 导出到 PostgreSQL。

Try: I tried from SQL Server IDE but at some stage its giving the error about data types are different.

尝试:我从 SQL Server IDE 尝试过,但在某个阶段它给出的关于数据类型的错误是不同的。

Question:How can I do export of data from SQL Server to PostgreSQL? Is COPY does my job? If yes, then how can I export all tables including records?

问题:如何将数据从 SQL Server 导出到 PostgreSQL?COPY 对我有用吗?如果是,那么如何导出包括记录在内的所有表?

采纳答案by NuongNguyen

You can't export data from MSsql then import to PostgreSql because it is not same syntax, data type, but you can use tool to migration data from mssql to postgreSql, See more in topic migrate data from MS SQL to PostgreSQL?

您不能从 MSsql 导出数据然后导入到 PostgreSql,因为它的语法、数据类型不同,但是您可以使用工具将数据从 mssql 迁移到 postgreSql,请参阅主题 将数据从 MS SQL 迁移到 PostgreSQL?

回答by ruipacheco

First export the schema into a file and run it against PostgreSQL until you've removed all incompatibilities.

首先将模式导出到一个文件中,然后针对 PostgreSQL 运行它,直到您删除所有不兼容性。

You could try to do the same with the data you want to export but you may be better off writing a Python script to migrate it.

您可以尝试对要导出的数据执行相同操作,但最好编写 Python 脚本来迁移它。

回答by Ehsan Mirsaeedi

There is an absolutely simple way using built-in SSIS tool using Management Studio. You can find the detailed answer here.

使用 Management Studio 使用内置 SSIS 工具是一种绝对简单的方法。你可以在这里找到详细的答案。