Just small update, to get the correct number of rows, the fix in the [dbo].[usp_sqlwatch_logger_disk_utilisation_table] is as follows:
…
insert into @t
select
schema_name = s.name,
table_name = t.name,
database_name = sdb.name,
database_create_date = sdb.create_date, row_count = convert(real,sum(case when i.index_id IN (0,1) and a.type = 1 then p.rows else 0 end)),
total_pages = convert(real,sum(a.total_pages)),
used_pages = convert(real,sum(a.used_pages)),
/* only take table compression into account and not index compression.
we have index analysis elsewhere */
[data_compression] = max(case when i.index_id = 0 then p.[data_compression] else 0 end)
from [?].sys.tables t
inner join [?].sys.indexes i on t.object_id = i.object_id
inner join [?].sys.partitions p on i.object_id = p.object_id AND i.index_id = p.index_id
inner join [?].sys.allocation_units a on p.partition_id = a.container_id
inner join [?].sys.schemas s on t.schema_id = s.schema_id
inner join sys.databases sdb on sdb.name = ‘’?‘’
group by s.name, t.name, sdb.name, sdb.create_date;