can we list all tables in msaccess database using sql?

后端 未结 6 1599
我寻月下人不归
我寻月下人不归 2020-11-30 11:22

Can we find all tables in the msaccess using sql .

as we do in sqlserver

select * from sys.tables  

in sqlite

SELE         


        
6条回答
  •  春和景丽
    2020-11-30 11:58

    The following query helped me scope a redesign/migration from MS Access to C# & SQL Server.

    Note: Combines answers provided by both Alex K. and KTys.
    Posted here with the belief that it will be useful to someone else (or myself if I have to do this again)

    SELECT
      SWITCH (
        [type]=-32764,'Report' ,
        [type]  =  1, 'Table, local' ,
        [type]  =  3, 'obj Containers' ,
        [type]  =  4, 'Table, link odbc' ,
        [type]  =  5, 'Query' ,
        [type]  =  6, 'Table, link access' ,
        [type]  =  8, 'SubDataSheets' ,
        TRUE, [type]
      ) AS [type name (or #)]
      , name AS [Table Name]
    FROM
      MSysObjects 
    ORDER BY 
      2, 3
    


    Note warning from KTys (type numbers are subject to change)
    Add , * to the select clause to see the other fields (such as connect); they weren't helpful to me.

    Created/tested with MS Access 2013

提交回复
热议问题