Converting your data from MS SQL Server 7 to PostgreSQL 7.1.x
From PostgreSQL wiki
by Ryan C. Bonham <firstname.lastname@example.org> v1.00, Last updated 5th January 2002
- MS SQL 7 (of course)
- RedHat Linux 7.1
- PostgreSQL 7.1 RPM's
- PostgreSQL ODBC Client
Follow the steps below to convert your Microsoft SQL Server 7 data to PostgreSQL.
From Your Redhat Machine
- As root, create a postgres user.
- Install the PostgreSQL RPM's on your machine.
- Start PostgreSQL for the first time.
service PostgreSQL start
- Set PostgreSQL to run at system Startup.
chkconfig --add PostgreSQL
- Login as the Postgres User
- Create a Blank Database
From your SQL 7 Server or a machine with the SQL administration tools installed
- Install the PostgreSQL ODBC Drivers
- Create A New User or System DSN (Data Source)
On Windows 2000, you can find this under the "Administrative Tools" Control Panel
- When Prompted for Driver to use, select "PostgreSQL"
- For Data Source enter the name you wish to give this connection. (e.g. Pgsql)
- For Database enter the name you used in Step 6 above
- For Server enter the IP or name of your PostgreSQL Database Server
- Leave the Username and password blank
- Under the Driver Options Select "Parse Statements" and Uncheck "Bools as char"
- Under "DataSource" Options select "Row Versioning"
- Open the SQL 7 Enterprise Manager
- Expand your server and select "Data Transformation Services"
- Open the "Local Packages"
- Select New package from the Action Menu
- Select "Microsoft OLE DB Provider for SQL Server" from the Data Menu
- Pick Your SQL Server and database you wish to export and press ok
- Select "Other Connection" from the Data menu
- For Data Source select "PostgreSQL"
- Select the DSN we created above (Pgsql)
- Enter your username (postgres)
- Select both Connections you just created
- Select "Add Transformation" from the Workflow menu
- Double click the Transformation Line that was just created
- On the sources tab select the table you wish to export
- On the destination tab select Create new
- Check the DataTypes and Column Lengths. Make any corrections and press ok
- 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.
- Check the options on the Advanced Tab. You shouldn't need to make changes
- Press Ok
- Select Save from the package menu
- Select Run from the package menu
- 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