且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从 MS Access 数据库中获取表名?

更新时间:2022-06-11 22:48:02

要以 Ilya 的回答为基础,请尝试以下查询:

To build on Ilya's answer try the following query:

SELECT MSysObjects.Name AS table_name
FROM MSysObjects
WHERE (((Left([Name],1))<>"~") 
        AND ((Left([Name],4))<>"MSys") 
        AND ((MSysObjects.Type) In (1,4,6)))
order by MSysObjects.Name 

(这个无需修改 MDB 即可工作)

(this one works without modification with an MDB)

ACCDB 用户可能需要做这样的事情

ACCDB users may need to do something like this

SELECT MSysObjects.Name AS table_name
FROM MSysObjects
WHERE (((Left([Name],1))<>"~") 
        AND ((Left([Name],4))<>"MSys") 
        AND ((MSysObjects.Type) In (1,4,6))
        AND ((MSysObjects.Flags)=0))
order by MSysObjects.Name 

因为包含一个额外的表,它似乎是某种系统表.

As there is an extra table is included that appears to be a system table of some sort.