I have a script with a few hundreds of sql queries that I need to execute on an Access DB. Since executing sql queries in Access is IMO quit awkward, you can only execute one at a time and does not recognize comment-lines starting with '--', I would like to know if there exist out there an easier way to do this. Is there a good alternative to MS Access to manage an Access DB ?
I would suggest writing a application or PowerShell script to read queries from a file and execute against the Access database. Read line by line ignoring lines beginning with your comment delimiter.
What about setting up links from an MS-SQL database to the access database and running the scripts through MS-SQL? Assuming you aren't doing altering table structures, you should be OK.
Two decent options:
Option 1: Write a C# program that will use the DAO libraries to automate Access and execute the statements programmatically.
dao.DBEngineClass dbengine = new dao.DBEngineClass();
dbengine.OpenDatabase(path, null, null, null);
dao.Database database = dbengine.Workspaces[0].Databases[0];
database.Execute(sql, null);
Option 2: Write a VBA module inside the database that will do the same thing using the CurrentProject.Connection.Execute()
method.
In either case you could put this code inside a loop that reads your statements and executes them one by one.
This question may help http://stackoverflow.com/questions/62504/is-there-any-way-to-create-multiple-insert-statements-in-a-ms-access-query