9

如何查看Microsoft Access 2013 表的元数据(数据字典) ?

4

3 回答 3

6

如果您想检索访问数据库元数据,这可能会有所帮助:

每个 microsoft access 数据库都包含一个名为MSysObjects. 此表包含此数据库元数据。您可以获得所有具有创建日期和最后更新日期的对象。

您可以使用以下查询列出 Access 数据库中的所有对象:

SELECT Name, DateCreate, DateUpdate,   
 iif(LEFT(Name, 4) = 'MSys','System Table', 
 iif(type = 2,'System Object',  
 iif(type = 3,'System Object', 
 iif(type = 8,'System Object',  
 iif(type = 4,'Linked Table (ODBC)', 
 iif(type = 1,'Table',  
 iif(type = 6, 'Linked Table (MsAccess/MsExcel)', 
 iif(type = 5,'Query',  
 iif(type = -32768,'Form', 
 iif(type = -32764,'Report',  
 iif(type=-32766,'Macro', 
 iif(type = -32761,'Module',  
 iif(type = -32756,'Page',  
 iif(type = -32758,'User','Unknown')))))))))))))) as ObjectType 
  FROM MSysObjects WHERE LEFT(Name, 1) <> '~' 

如果您不想显示系统对象,可以将这些条件添加到 where 子句:

AND LEFT(Name, 4) <> 'MSys' AND Type IN (1, 5, 4, 6,  -32768, -32764, -32766, -32761,-32756,-32758)

在此处输入图像描述

我还创建了一个从访问数据库中检索数据的应用程序,我为它创建了一个新的Git 存储库

于 2017-06-04T13:59:55.957 回答
5

在 Access 2007 及更高版本(2007、2010、2013)中,“Database Documenter”位于“Database Tools”选项卡下的“Analyze”组中。显示按钮的屏幕截图

于 2014-07-06T04:48:37.020 回答
2

使用 VBA,该DAO.TableDef对象可以帮助您:

dim db as DAO.Database, tbl as DAO.TableDef
dim f as DAO.Field
set db = currentdb() ' Connect to current database

' Loop through each table in the database
for each tbl in db.tableDefs
    debug.print "Table name: ", tbl.Name
    ' Loop throuth each field in the table
    for each f in tbl.Fields
        debug.print "Field: ", f.Name
    next f
next tbl

这非常简单,但您可以获得表及其字段的所有属性。

查看:

于 2014-07-06T04:50:08.750 回答