ess ess - 9 months ago 74
SQL Question

Getting the table structure in ms access with SQL query?

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'.


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.