查询数据的库名 查询指定数据库下的表名 查询指定数据库下的指定表的列名

查询所有数据库名
SELECT Name FROM Master..SysDatabases
查询指定数据库下的表名和视图名
select * from 数据库名..sysobjects where xtype='V'or xtype='U'
查询指定数据库下的指定表的列名
   select name from 数据库名.dbo.syscolumns where id=(select id from 数据库名.dbo.sysobjects where (xtype='U' or xtype='V' ) and name='表名')

猜你喜欢

转载自www.cnblogs.com/skyhorseyk/p/9212464.html
今日推荐