Applied on: Windows Hosting Account with SQL Server Database

 

This step show you the space usage by your SQL database and by its log file. This will show space size in MB.

 

Steps:-

 

1. Open Microsoft SQL Server Manager Studio to connect with SQL Database

 

2. Click on your database to select your database

 

3. Create new query

 

4.  Now use below T-SQL Script into this newly opened Query windows

 

5. Execute this query by clicking Execute Button or press F5 Key to execute it.

 

T-SQL Script:-
SELECT DB_NAME() AS DATABASENAME
, NAME AS FILENAME
, SIZE/128.0 AS CURRENTSIZEONDISK_MB
, CAST(FILEPROPERTY(NAME, 'SPACEUSED') AS INT)/128.0 AS SPACEUSED_MB
FROM SYS.DATABASE_FILES

 

There is no variable used in this query so no need to change anything.