1.查询数据库中的所有数据库名:
SELECT Name FROM Master..SysDatabases ORDER BY Name
2.查询某个数据库中所有的表名:
SELECT Name FROM SysObjects Where XType='U' ORDER BY Name
==表中字段
1、方法一
SELECT * FROM INFORMATION_SCHEMA.columns WHERE TABLE_NAME='表名'
2、方法二
select a.name tablename, b.name colName, c.name colType ,c.length colLength
from sysobjects a inner join syscolumns bon a.id=b.id and a.xtype='U'
inner join systypes c
on b.xtype=c.xusertype
where a.name='表名'