Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

This page is user contributed documentation. See the bottom of the page for information about the author.  

mssql 7 pgsql 7

Converting your data from MS SQL Server 7 to PostgreSQL 7.1.x

by Ryan C. Bonham <ryan@ryanbonham.com>
v1.00, Last updated 5th January 2002

Prerequisites


Directions

Follow the steps below to convert your Microsoft SQL Server 7 data to PostgreSQL.
Anything following a "#" is the exact command to type at the shell prompt.

From Your Redhat Machine

  1. As root, create a postgres user.
    # adduser postgres

  2. Install the PostgreSQL RPM's on your machine.

  3. Start PostgreSQL for the first time.
    # service PostgreSQL start

  4. Set PostgreSQL to run at system Startup.
    # chkconfig --add PostgreSQL

  5. Login as the Postgres User
    # su postgres

  6. Create a Blank Database
    # createdb Databasename

From your SQL 7 Server or a machine with the SQL administration tools installed

  1. Install the PostgreSQL ODBC Drivers

  2. Create A New User or System DSN (Data Source)
    On Windows 2000, you can find this under the "Administrative Tools" Control Panel

    1. When Prompted for Driver to use, select "PostgreSQL"

    2. For Data Source enter the name you wish to give this connection.  (e.g. Pgsql)

    3. For Database enter the name you used in Step 6 above

    4. For Server enter the IP or name of your PostgreSQL Database Server

    5. Leave the Username and password blank

    6. Under the Driver Options Select "Parse Statements" and Uncheck "Bools as char"

    7. Under "DataSource" Options select "Row Versioning"

  3. Open the SQL 7 Enterprise Manager

  4. Expand your server and select "Data Transformation Services"

  5. Open the "Local Packages"

  6. Select New package from the Action Menu

  7. Select "Microsoft OLE DB Provider for SQL Server" from the Data Menu

    1. Pick Your SQL Server and database you wish to export and press ok

  8. Select "Other Connection" from the Data menu

    1. For Data Source select "PostgreSQL"

    2. Select the DSN we created above (Pgsql)

    3. Enter your username (postgres)

  9. Select both Connections you just created

  10. Select "Add Transformation" from the Workflow menu

  11. Double click the Transformation Line that was just created

    1. On the sources tab select the table you wish to export

    2. On the destination tab select Create new

    3. Check the DataTypes and Column Lengths.  Make any corrections and press ok

    4. On the Transformation screen make sure the source columns are pointing to the correct destination columns.  You can change the Column mappings by selecting the appropriate columns and using the delete and insert buttons on the screen.

    5. Check the options on the Advanced Tab.  You shouldn't need to make changes

    6. Press Ok

  12. Select Save from the package menu

  13. Select Run from the package menu

  14. Your data should now be exported.  If you get any errors double check the data type and lengths are correct on the table you created in Step 11

Updated: 2006-04-03 13:08
Author: Robert Treat
Long time PostgreSQL Contributor, Co-Author of Begining PHP and PostgreSQL 8
Operations: Edit Create subpage (Requires community login)

Privacy Policy | Project hosted by hub.org | Designed by tinysofa
Copyright © 1996 – 2007 PostgreSQL Global Development Group