查询数据库里所有表名和字段名的语句
SQL 查询所有表名
- SELECT NAME FROM SYSOBJECTS WHERE TYPE='U'
- SELECT * FROM INFORMATION_SCHEMA.TABLES
查询表的所有字段名
- SELECT NAME FROM SYSCOLUMNS WHERE ID=OBJECT_ID(' 表名' )
- SELECT * FROM INFORMATION_SCHEMA.TABLES
- SELECT * FROM INFORMATION_SCHEMA.VIEWS
- SELECT * FROM INFORMATION_SCHEMA.COLUMNS
查询该库所有表名对应的字段名
- SELECT TABLE_NAME, COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = '库名'
ORACLE 查看所有表名
- SELECT TABLE_NAME FROM USER_TABLES
ACCESS 查看所有表名
- SELECT NAME FROM MSYSOBJECTS WHERE TYPE=1 AND FLAGS=0
- MSYSOBJECTS 是系统对象,默认情况是隐藏的。通过工具、选项、视图、显示、系统对象可以使之显示出来