views:

37

answers:

2

I have got a bakcup of a live database (A copy of an ACCDB format Access database) in which I've worked, added new fields to existing tables and whole new tables.

How do I get these changes and apply that fastly in the running database?

In MS SQL Server, I'd right-click > Script Table As > Alter To, save the query and run it wherever I desire, is there an as easy way as that to do it in an Access Database ?

Details: It's an ACCDB MS-Access database created on Access 2007, copied and edited in Access 2007, in which I need to get some "alter" scripts to run on the other database so that it has all the new columns and tables I've created on my copy.

A: 

You can run DDL in Access. I think it would be easiest to run the SQL with VBA, in this case.

Remou
A: 

For new tables, just import them from one database into the other. In the "External Data" section of the ribbon, choose the Access icon above "Import". That choice starts an import wizard to allow you to select which objects you want imported. You will have a choice to import just the table structure, or both structure and data.

Remou is right that you can use DDL ALTER TABLE statements to add new columns. However, DDL might not support every feature you want for your new columns. And if you want not just the empty columns added, but also also any data from those new columns, you will probably need to run UPDATE statements to get it into your new columns.

As far as "Script Table As", see if OmBelt's Export Table to SQL tool for MS Access can do what you want.

Edit: Allen Browne has sample ALTER TABLE statements. See CreateFieldDDL and the following one, CreateFieldDDL2.

HansUp
I want the empty columns. How do I use this DLL Alter Table ?
MarceloRamires
@Marcelo I added a link to Allen Browne's site to get you started.
HansUp