Postgresql – How to Reorganize Microsoft Access Table

postgresql

I have just taken over a retiring DBA's position and is responsible for migrating the current access database to SQL Server or PostgreSQL. Right now, the table structure is a mess. Instead of properly establishing relationships between tables, multiple fields and parameters are cramped in a single table.

I have broken up the table and plan to regroup the parameters into separate individual tables and link them together. My question is, the unorganized tables contain many rows of data, with over 40 different parameters, what is the best way to break up the table and still have all the data repopulated in the new tables linked?

Best Answer

I think your best bet is to do the restructuring in Access. After you're confident everything works, you can

  • create tables and constraints in PostgreSQL,
  • export tables from Access as CSV files, and
  • load the CSV files into PostgreSQL.

Everything works includes application code.

Make sure your Access database is backed up, copied, and not in use before you make structural changes.

To restructure tables in Access,

  • select distinct rows into a new table ("make table" query), or
  • create views (saved queries) that select the right rows and columns, or
  • copy a table, open it in design view, and delete irrelevant columns. (You'll probably want to delete some columns from the original table, too.)

I'm pretty sure Access lets you export the results of a query, so you can build queries that have the right structure, then export the queries.