SQL Server统计数据库总量
按月查看历史数据的增长
SELECT[database_name] AS "Database",DATEPART(month,[backup_start_date]) AS "Month",AVG([backup_size]/1024/1024) AS "Backup Size MB"FROM msdb.dbo.backupsetWHERE [database_name] = N‘Adventureworks2012‘AND [type] = ‘D‘GROUP BY [database_name],DATEPART(mm,[backup_start_date]);
查询数据库总数据条数
1、
select
sum(c.row_count) as datacount
from sys.indexes a ,
sys.objects b ,
sys.dm_db_partition_stats c
where a.[object_id] = b.[object_id]
AND b.[object_id] = c.[object_id]
AND a.index_id = c.index_id
AND a.index_id < 2
AND b.is_ms_shipped = 0
2:
select b.name as tablename ,
a.rowcnt as datacount
from sysindexes a ,
sysobjects b
where a.id = b.id
and a.indid < 2
and objectproperty(b.id, ‘IsMSShipped‘) = 0
相关推荐
bleach00 2020-11-10
lmllouk 2020-11-02
一片荷叶 2020-10-28
jiong 2020-10-31
Youda 2020-08-29
thunderstorm 2020-08-19
guodaoying 2020-08-16
whyname 2020-08-16
zjyzz 2020-08-16
nan00zzu 2020-08-08
zyjj 2020-07-26
xwb 2020-07-19
云之飞踢 2020-07-08
chenjiazhu 2020-07-08
明月清风精进不止 2020-07-05