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 b
on a.id=b.id and a.xtype='U'
inner join systypes c
on b.xtype=c.xusertype

where a.name='表名'



相关文章:

  • 2021-11-02
  • 2021-09-23
  • 2021-12-12
  • 2021-12-08
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-02
相关资源
相似解决方案