sql查询语句

//查询表的字段名和字段类型
select column_name,data_type from information_schema.columns
where table_name = '表名'

//查询数据库对应的所有表名
select [id], [name] from [sysobjects] where [type] = 'u' order by [name]
//查询数据库所有数据库名
//1.链接字符串
Data Source=.;Initial Catalog=master;Integrated Security = SSPI;
//2.查询语句
SELECT Name FROM Master..SysDatabases ORDER BY Name

原文地址:https://www.cnblogs.com/raorao1994/p/5575506.html