sql 查询所有数据库、表名、表字段的代码

发布时间:2020-03-26编辑:脚本学堂
sql 查询所有数据库、表名、表字段的代码,供大家学习参考。

1、查询所有表

select [id], [name] from [sysobjects] where [type] = 'u' order by [name]

2、查询所有数据库

select [name] from [sysdatabases] order by [name]

3、查询表中字段

select [name] from [syscolumns] where [name] = 'tableXXX'order by [colid]