查询数据库里所有表名和字段名

时间:2022-06-03 14:47:40

SQL 查询所有表名:

1 SELECT NAME FROM SYSOBJECTS WHERE TYPE='U'
2 SELECT * FROM INFORMATION_SCHEMA.TABLES

 

查询表的所有字段名:

1 SELECT NAME FROM SYSCOLUMNS WHERE ID=OBJECT_ID(' 表名' )
2 SELECT * FROM INFORMATION_SCHEMA.TABLES
3 SELECT * FROM INFORMATION_SCHEMA.VIEWS
4 SELECT * FROM INFORMATION_SCHEMA.COLUMNS

 

ORACLE 查看所有表名:

1 SELECT TABLE_NAME FROM USER_TABLES

 

ACCESS 查看所有表名:

1 SELECT NAME FROM MSYSOBJECTS WHERE TYPE=1 AND FLAGS=0