摘要: 1、脚本 SET NOCOUNT ON SELECT total_elapsed_time / 1000 /1000 N'总执行时间(s)' , execution_count N'执行次数' , ( total_elapsed_time / execution_count ) / 1000 /10 阅读全文
posted @ 2020-07-02 14:31 佳蓝雨 阅读(1306) 评论(0) 推荐(0) 编辑
摘要: 1、脚本(分区表显示为多个结果) ;with t1 as ( select t.name as tableName, cast(round(((sum(a.total_pages) * 8) / 1024.00 /1024.00),2) as numeric(36,2)) as totalSpace 阅读全文
posted @ 2020-07-02 14:29 佳蓝雨 阅读(348) 评论(0) 推荐(0) 编辑
摘要: 1、脚本 select t.name as tableName, s.name as schemaName, p.rows as rowCounts, sum(a.total_pages) * 8 as totalSpaceKB, cast(round(((sum(a.total_pages) * 阅读全文
posted @ 2020-07-02 14:10 佳蓝雨 阅读(402) 评论(1) 推荐(0) 编辑
摘要: 1、脚本 SET NOCOUNT ON declare @sql nvarchar(max) declare @sql2 nvarchar(max) declare @dbname nvarchar(50) create table #db_log_size (database_name nvarc 阅读全文
posted @ 2020-07-02 14:07 佳蓝雨 阅读(381) 评论(0) 推荐(0) 编辑
摘要: 1、脚本 SET NOCOUNT ON declare @sql nvarchar(max) declare @sql2 nvarchar(max) declare @dbname nvarchar(50) create table #db_log_size (database_name nvarc 阅读全文
posted @ 2020-07-02 14:03 佳蓝雨 阅读(2375) 评论(0) 推荐(0) 编辑
摘要: 1、在SQL2005、SQL2008、SQL2012、SQL2014、SQL2016、SQL2017、SQL2019版本上都做过测试。 2、没有存放SQLServer数据文件或日志文件的磁盘不显示。 3、具体脚本 SET NOCOUNT ON IF @@VERSION LIKE 'Microsoft 阅读全文
posted @ 2020-07-02 13:47 佳蓝雨 阅读(1143) 评论(0) 推荐(0) 编辑