Stored Procedure sp_databases returns database size as Null when database size is in Terabytes. Please find below the result of the stored procedure execution in one of my instance where database size is 6TB.

Stored Procedure sp_databases returns database size as Null when database size is in Terabytes. Please find below the result of the stored procedure execution in one of my instance where database size is 6TB.

Since this is expected for databases over 2GB, I created a documentation pull request to include this behavior in the remarks section.
The data type of DATABASE_SIZE in the output of sp_databases is int. The biggest number of int is 2,147,483,647. If the database size is over 2.15TB, it can not be displayed. That might be the reason why it is NULL.
Welcome to Microsoft Q&A!
Agreed with Guoxiong, in official document sp_databases as below:
Column name |Data type |Description
DATABASE_SIZE |int |Size of database, in kilobytes
Then the maximum of database size could be shown is 2147483647(KB)/1024/1024
=2047(GB)~2(TB) which is much smaller than 6TB as you mentioned. So it would show as NULL.
Best regards
Melissa
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Thanks everyone for helping me out here. I extracted the query used by stored procedure and modified it to convert the size to numeric instead of int.
14 people are following this question.
Year and Month aggregation in same Pivot table in SQL Server
SQL Server Query for Searching by word in a string with word breakers
How to show first row group by part id and compliance type based on priorities of Document type?
Query to list all the databases that have a specific user
T-sql query to find the biggest table in a database with a clustered index