如何从MS Access数据库获取表名? [英] How can I get table names from an MS Access Database?

查看:85
本文介绍了如何从MS Access数据库获取表名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Microsoft SQL Server和MySQL具有我可以查询的INFORMATION_SCHEMA表.但是,它在MS Access数据库中不存在.

Microsoft SQL Server and MySQL have an INFORMATION_SCHEMA table that I can query. However it does not exist in an MS Access database.

我可以使用等效的东西吗?

Is there an equivalent I can use?

推荐答案

要基于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.

这篇关于如何从MS Access数据库获取表名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆