Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Query to return table names?

0 views
Skip to first unread message

Ray Maas

unread,
Feb 7, 2003, 2:21:41 PM2/7/03
to
What query will return all the table names in my MSAccess database?

Also (I know this belongs in another newsgroup, but while I'm on the
subject), will the same query work with SQL Server?

Thanks in advance,
Ray Maas

Gary Walter

unread,
Feb 7, 2003, 4:00:41 PM2/7/03
to

"Ray Maas" <ma...@eglin.af.mil> wrote

> What query will return all the table names in my MSAccess database?
>
> Also (I know this belongs in another newsgroup, but while I'm on the
> subject), will the same query work with SQL Server?
>
Hi Ray,

I believe the following is correct.

For *ALL* tables:

SELECT [Name] FROM MSysObjects
WHERE [Type] = 1 OR [Type] = 6;

Type 1 = native tables
Type 6 = links to Access Tables
Type 4 = links to SQL tables


For user-defined, native tables only:

SELECT [Name] FROM MSysObjects
WHERE (([Name] Not Like "MSys*")
AND ([Type] = 1));

In MS SQL Server (user defined tables only)

SELECT NAME FROM SYSOBJECTS WHERE XTYPE='U',

I could be wrong.

Gary Walter


0 new messages