Getting the table structure in ms access with SQL query?

18.6k views Asked by At

How to get the table structure in MS Access with a SQL query?

Using the following query:

SELECT name FROM MSysObjects

Results in the following exception:

Exception: [Microsoft][ODBC Microsoft Access Driver] Record(s) cannot be read; no read permission on 'MSysObjects'.

3

There are 3 answers

2
Vignesh Kumar A On BEST ANSWER

Use This

SELECT * FROM MSysObjects WHERE Type=1 AND Flags=0

Ms Access has several system tables that are, by default, hidden from tables list. You can show them.

In Ms Access 2007 do a right click on tables list and select Navigation Options. At the bottom of the form you will find Show System Objects check box. Check it and system tables will show up in tables list. They all start with MSys. Alternatively, options form can be activated from application menu - click button Access options -> select Current Database and there is Navigation Options button.

Now you can examine structure and contents and generate queries of all system tables with MsAccess tools.

Source

0
FreeText On

To resolve the permissions issue for MSysObjects, see these similar questions: no read permission on 'MSysObjects', or Run C# queries against (hidden) system tables in Access?

1
Cari Sayler On

Set up an ODBC connection for your postrgres database and then call the transfer database command for each of your tables.