http://qs321.pair.com?node_id=729820


in reply to Re: Perl DBI + Access bind issues
in thread Perl DBI + Access bind issues

Being it is Access, you could copy the database file and rename the columns in the copy. This way you get quick access to the production data without altering the production database.

Can you export the tables to CSV and import to your new database from there? I've found this is the fastest way to perform ad-hoc queries against an Access database at work. I dump all of the tables to CSV and import them into PostgreSQL. If your target database can't import from CSV it would be simple to write such a utility in perl.

90% of every Perl application is already written.
dragonchild

Replies are listed 'Best First'.
Re^3: Perl DBI + Access bind issues
by pfaut (Priest) on Dec 12, 2008 at 02:05 UTC

    I just had another idea. You can't alter the tables but can you create a query? You can rename the columns in the query. SELECT [Active?] as active, .... Then select from the query instead of the table in your perl code.

    90% of every Perl application is already written.
    dragonchild
Re^3: Perl DBI + Access bind issues
by KurtSchwind (Chaplain) on Dec 12, 2008 at 02:06 UTC

    I can export each table, but I haven't found a way to automate it. It's pretty tedious to select every table one at a time and export.

    Is there an Access trick I'm missing?

    --
    I used to drive a Heisenbergmobile, but every time I looked at the speedometer, I got lost.

      Yes. You can script Access using Visual Basic. I wrote a function that exports all of the tables I'm interested in but I don't remember the calls to do it. I can look it up when I get to work tomorrow morning.

      90% of every Perl application is already written.
      dragonchild

        I just looked up how I did this and there's no need for VB. It can be done using a macro in Access. I created a macro called ExportTables. For each table to be exported I added a 'TransferText' action. Set transfer type to 'Export Delimited' and specify the table and file names. If you want the first row of the CSV file to contain the column names set 'Has Field Names' to 'Yes'. After adding an action for each table you can execute the macro and it should create CSV files for the tables you entered.

        90% of every Perl application is already written.
        dragonchild