简体   繁体   中英

How can I import a database schema into MS Access 2003 from sql text file?

I have a database schema generated in a text file (DDL - MS Access compliant).

Where is the option in MS Access to import that schema into an empty database ?

I'm not aware of any import for DDL.

However, DDL contains the definition for the schema.

You simply have the execute DDL as you would any query.

Either create a query, put it in sql mode, paste your ddl, and execute

or....

Create a VBA Sub to essentially do the same: currentdb.execute SQL

Good Luck

To execute a SQL DDL in the SQL View of a Query object, you may need to change the Access user interface to ANSI-92 Query Mode . While the 'traditional' query mode (ANSI-89 Query Mode) supports a SQL DDL syntax it is very limited.

The Access database engine can only execute one SQL statement (DML, DDL or DCL) at a time. To execute a SQL script consisting of multiple SQL statement, you need something to parse individual SQL statements, so it really helps if your script has semicolon ; characters separating them, then execute each statement on at a time ie synchronously. If you are doing this in VBA code you are better off using ADO because it always uses ANSI-92 Query Mode.

查看是否有帮助: http : //support.microsoft.com/kb/180841

I have been very succesful with reverse / forward engineering MS Access databases with Dezign for Databases by Datanamic. It reads all kinds of DDL scripts (from almost all available database) and can translate between different databases. There is a free trial available.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM