--查询所有数据库
USE master
go
select [name] from [sysdatabases] order by [name]

MSSQL查询所有数据库表,指定数据库的字段、索引

--查询其中一个数据库test,就可以得到这个数据库中的所有的表名了,语句如下:
USE test
go
select [id], [name] from [sysobjects] where [type] = 'u' order by [name]

MSSQL查询所有数据库表,指定数据库的字段、索引

--查出v_lyb这个表中所有的字段
select [name] from [syscolumns] where [id] = 21575115 order by [colid]

MSSQL查询所有数据库表,指定数据库的字段、索引
--得到该表中的记录条数前提这个表中要建立索引

select [o].[id], [o].[name], [i].[rows] from [sysindexes] [i], [sysobjects] [o] where [i].[first]>0 and [o].[id]=[i].[id] and [o].[type]='u' and [o].[id]=21575115

MSSQL查询所有数据库表,指定数据库的字段、索引

 

相关文章:

  • 2022-12-23
  • 2021-11-03
  • 2022-12-23
  • 2021-12-17
  • 2022-01-04
  • 2021-12-08
  • 2021-11-29
  • 2021-05-15
猜你喜欢
  • 2021-10-19
  • 2022-12-23
  • 2021-10-19
  • 2022-12-23
  • 2022-02-24
  • 2022-03-09
相关资源
相似解决方案