I need to get the number of databases on one instance with Total Sapce Used, Total Space Alocated and Total Free Space
The point is that in the second query result Q2:
the result of the number of databases appear completely out of the reality
Can anyone explain me what am i doing wrong.
Thanks and regards,
select count(name) from sys.sysdatabases
select @@servername as 'instance name', count(*) as 'Nº of DBs by Instance', sum(a.size) as 'espaço alocado (mb)', sum(a.used) as 'espaço utilizado (mb)', sum(a.size)-sum(a.used) as 'espaço livre (mb)'
from db_name..tbl_name a, sys.sysdatabases b
40405288 23075475 17329813Q3:
select @@servername as 'instance name', count(*) as 'Nº of DBs by Instance'