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

查看:55
本文介绍了如何从 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天全站免登陆