Question:
Convert PostgreSQL database dump to MSSQL?
prestige r
2008-06-15 21:22:09 UTC
I have a PostgreSQL database dump file which is called database.sql. Now I want to convert and import that database.sql into MSSQL. However I can't excute the sql directly because it's the PostgreSQL. like the following

--
-- PostgreSQL database dump
--

SET client_encoding = 'LATIN1';
SET check_function_bodies = false;
SET client_min_messages = warning;

--
-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres
--

COMMENT ON SCHEMA public IS 'Standard public schema';


SET search_path = public, pg_catalog;

SET default_tablespace = '';

SET default_with_oids = false;

--
-- Name: club; Type: TABLE; Schema: public; Owner: cancel; Tablespace:
--

CREATE TABLE club (
club_id serial NOT NULL,
name character varying(70) NOT NULL,
region integer NOT NULL
);


Anybody know if there are other ways to do this? Cheers Very Much.
Three answers:
jpasher
2008-06-16 15:29:26 UTC
The first thought I would have is why would you be going from a superior DB server to an inferior one, but I digress.



As far as the text dump file goes, you'd have better luck restoring it to a Postgres database and finding a conversion program that can dump the file directly to MySQL or into a MySQL compatible format. There are probably not any utilities that will work directly on the text version of the dump, since it's much easier to connect directly to the DB server to extract the data versus parsing a text file.



EDIT:



Doh. Misread MSSQL for MySQL (my DB opinion still remains the same though :). Regardless of whether you are going to MSSQL, Oracle, or MySQL, the same general process would apply. You can even install Postgres on Windows if you don't have access to a Linux box for installation (the dump file looks like it's from Postgres 8, so either 8.2 or 8.3 should hopefully work for you). Keep in mind that if your database has any more advanced features (stored procedures, triggers, rules, etc), then the conversion will not be quite as straight forward.



Possible programs (untested):

http://www.sobolsoft.com/mssqlpostgresql/

http://dbconvert.com/convert-mssql-to-postgre-pro.php?DB=3
?
2016-11-04 08:18:56 UTC
Convert Mssql To Postgresql
stockstill
2016-10-18 01:06:06 UTC
What do you advise a database made up of javascript? the place is the information saved? there is not any primary thank you to try this because of the fact the 'javascript' database code have been programmed in any style of strategies


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...