Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Shell script to convert Access DB to SQL - Requires mdbtools
#!/bin/bash
TABLES=$(mdb-tables -1 $1)
for t in $TABLES
do
echo "DROP TABLE IF EXISTS $t;"
done
mdb-schema $1 mysql
for t in $TABLES
do
mdb-export -D '%Y-%m-%d %H:%M:%S' -I mysql $1 $t
done
@jerryq27

This comment has been minimized.

Copy link

@jerryq27 jerryq27 commented Jul 5, 2018

I made some adjustments to this script since I've had issues when I ran it

  • Table names with spaces
  • Values with the ` or ' character
  • Values with back slashes
  • Large Text values from Access being limited to (255) characters

I wanted to submit a pull request, but I can't do that with gists, so I'll link a gist with the changes here instead.

@dartmann

This comment has been minimized.

Copy link

@dartmann dartmann commented Mar 19, 2019

@jerryq27 your gist link is dead

@0x70b1a5

This comment has been minimized.

Copy link

@0x70b1a5 0x70b1a5 commented Sep 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.