码迷,mamicode.com
首页 > 数据库 > 详细

sqlserver查询数据的所有表名和行数

时间:2016-01-12 11:20:10      阅读:222      评论:0      收藏:0      [点我收藏+]

标签:

//查询所有表明
select name from sysobjects where xtype=‘u‘

select * from sys.tables


//查询数据库中所有的表名及行数

SELECT a.name, b.rows

FROM sysobjects AS a INNER JOIN sysindexes AS b ON a.id = b.id

WHERE (a.type = ‘u‘) AND (b.indid IN (0, 1))

ORDER BY a.name,b.rows DESC


//查询所有的标明及空间占用量\行数

select

object_name(id) tablename,

8*reserved/1024 reserved,

rtrim(8*dpages)+‘kb‘ used,

8*(reserved-dpages)/1024 unused,

8*dpages/1024-rows/1024*minlen/1024 free,

rows

--,*

from sysindexes

where indid=1

order by tablename,reserved desc

  

sqlserver查询数据的所有表名和行数

标签:

原文地址:http://www.cnblogs.com/sumkp/p/5123439.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!