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

posted @ 2016-06-11 16:38  扰扰  阅读(147)  评论(0编辑  收藏  举报