sql serverは、テーブルの数など、データベースのステータス情報をどのように表示しますか?

6457 ワード

変換元:http://www.cnblogs.com/fumj/archive/2013/02/26/2933727.html
//      
select name from sysobjects where xtype='u'

select * from sys.tables

//         :
select max_column_id_used from sys.tables where name='T_DISTRICT';

//              

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