简体   繁体   English

如何从SQL文本文件将数据库架构导入MS Access 2003?

[英]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). 我有一个在文本文件中生成的数据库架构(DDL-符合MS Access)。

Where is the option in MS Access to import that schema into an empty database ? MS Access中将该架构导入空数据库的选项在哪里?

I'm not aware of any import for DDL. 我不知道任何DDL导入。

However, DDL contains the definition for the schema. 但是,DDL包含模式的定义。

You simply have the execute DDL as you would any query. 您只需像执行任何查询一样就具有执行DDL。

Either create a query, put it in sql mode, paste your ddl, and execute 创建一个查询,将其置于sql模式,粘贴您的ddl,然后执行

or.... 要么....

Create a VBA Sub to essentially do the same: currentdb.execute SQL 创建一个VBA Sub基本上执行相同的操作: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 . 要在Query对象的SQL视图中执行SQL DDL,您可能需要将Access用户界面更改为ANSI-92 Query Mode While the 'traditional' query mode (ANSI-89 Query Mode) supports a SQL DDL syntax it is very limited. 虽然“传统”查询模式(ANSI-89查询模式)支持SQL DDL语法,但是它非常有限。

The Access database engine can only execute one SQL statement (DML, DDL or DCL) at a time. Access数据库引擎一次只能执行一个SQL语句(DML,DDL或DCL)。 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 ; 要执行一个由多个SQL语句组成的SQL脚本,您需要一些内容来解析单个SQL语句,因此,如果您的脚本具有分号,则确实很有用; 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. 如果在VBA代码中执行此操作,则最好使用ADO,因为它始终使用ANSI-92查询模式。

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

I have been very succesful with reverse / forward engineering MS Access databases with Dezign for Databases by Datanamic. 我对Datanamic的Dezign for Databases进行的反向/正向工程MS Access数据库非常成功。 It reads all kinds of DDL scripts (from almost all available database) and can translate between different databases. 它读取各种DDL脚本(从几乎所有可用的数据库中读取),并可以在不同的数据库之间进行转换。 There is a free trial available. 有免费试用版。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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