Recently, I got the requirement to check the size of my SQL server database. I have identified a few simple and quick approaches to achieve that. In this article, I will guide you through all those approaches to check the size of the DB in an SQL server.
How To Check DB Size In SQL Server
Let us discuss the approaches individually.
Approach-1: Using SQL Server Management Studio (SSMS)
To check DB size in the SQL server, follow the steps below.
1. Log in to the Sql Server Management Studio.
2. Expand the database node, Right-click on the database name, and select the Properties option, as shown in the screenshot below.

3. Click on the General tab to see the Size of the SQL server db under the Database section, as highlighted in the screenshot below.

Approach-2: Using DBCC SQLPERF
Suppose you wish to check all DB size in SQL server. Execute the below query.
DBCC SQLPERF(LOGSPACE);
After executing the above query, I got the expected output below.

Check out How to View SQL Server Error Logs
Approach-3: Using sp_spaceused
If you wish to get the size of a specific database, you can execute the below query.
USE Test;
GO
EXEC sp_spaceused;
After executing the above query, I got the expected output successfully, as shown below.

Approach-4: Using sys.database_files
We can also use sys.database_files for this purpose. Execute the below query.
SELECT
name AS DatabaseName,
size/128.0 AS TotalSizeMB
FROM sys.database_files
WHERE type_desc = 'ROWS';
After executing the above query, I got the expected output, as shown in the screenshot below.

Conclusion
Knowing the size of your SQL server database is essential if you wish to manage your database effectively. The approaches mentioned above are the ways to achieve this.
You may also like following the articles below.
- How To Find Database Name In SQL Server
- How To Enable Filestream In SQL Server
- How to Export Data from SQL Server to Excel
- How to Select the Latest Record in SQL Server?
- How to Create Temp Table in SQL Server
I am Bijay having more than 15 years of experience in the Software Industry. During this time, I have worked on MariaDB and used it in a lot of projects. Most of our readers are from the United States, Canada, United Kingdom, Australia, New Zealand, etc.
Want to learn MariaDB? Check out all the articles and tutorials that I wrote on MariaDB. Also, I am a Microsoft MVP.