简体   繁体   English

使用SQL查询在MS Access中获取表结构?

[英]Getting the table structure in ms access with SQL query?

How to get the table structure in MS Access with a SQL query? 如何使用SQL查询在MS Access中获取表结构?

Using the following query: 使用以下查询:

SELECT name FROM MSysObjects

Results in the following exception: 导致以下异常:

Exception: [Microsoft][ODBC Microsoft Access Driver] Record(s) cannot be read; 例外:[Microsoft] [ODBC Microsoft Access驱动程序]记录无法读取; no read permission on 'MSysObjects'. 对“ MSysObjects”没有读取权限。

若要解决MSysObjects的权限问题,请参阅以下类似问题: 对“ MSysObjects”没有读取权限 ,还是对Access中的(隐藏)系统表运行C#查询?

Use This 使用这个

SELECT * FROM MSysObjects WHERE Type=1 AND Flags=0

Ms Access has several system tables that are, by default, hidden from tables list. Access女士有几个系统表,默认情况下,这些系统表从表列表中隐藏。 You can show them. 您可以向他们展示。

In Ms Access 2007 do a right click on tables list and select Navigation Options. 在Ms Access 2007中,右键单击表列表,然后选择“导航选项”。 At the bottom of the form you will find Show System Objects check box. 在窗体的底部,您将找到“显示系统对象”复选框。 Check it and system tables will show up in tables list. 选中它,系统表将显示在表列表中。 They all start with MSys. 它们都是从MSys开始的。 Alternatively, options form can be activated from application menu - click button Access options -> select Current Database and there is Navigation Options button. 或者,可以从应用程序菜单激活选项表单-单击按钮“访问选项”->选择“当前数据库”,然后有“导航选项”按钮。

Now you can examine structure and contents and generate queries of all system tables with MsAccess tools. 现在,您可以检查结构和内容,并使用MsAccess工具生成所有系统表的查询。

Source 资源

为您的postrgres数据库设置ODBC连接,然后为每个表调用transfer database命令。

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

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