1. table size

SELECT table_name = convert(varchar(30), min(o.name))
 , table_size = convert(int, ltrim(str(sum(cast(reserved as bigint)) * 8192 / 1024., 15, 0))), UNIT = 'KB'
FROM sysindexes i
  INNER JOIN
  sysobjects o
  ON (o.id = i.id)
WHERE i.indid IN (0, 1, 255)
AND  o.xtype = 'U'
GROUP BY i.id
ORDER BY table_size DESC;

 

2. table count

SELECT o.name, i.rows FROM sysindexes i INNER JOIN sysobjects o ON i.id = o.id
WHERE i.indid < 2 AND o.xtype = 'U' ORDER BY o.name;

'Knowledge > SQL-server' 카테고리의 다른 글

Prevent windows authentication  (0) 2015.01.27
Posted by neo-orcl
,