Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi guys,
I Am using sql server free version for learning purpose.
How to check how much GB the server is providing (in percentage)as a free version?
like below as example
(1) Total Space:10gb
(2) used space=7gb
(3) Remaining space: 3gb


How to check the remaining free space of server?

What I have tried:

SELECT
t.object_id,
OBJECT_NAME(t.object_id) ObjectName,
sum(u.total_pages) * 8 Total_Reserved_kb,
sum(u.used_pages) * 8 Used_Space_kb,
u.type_desc,
max(p.rows) RowsCount
FROM
sys.allocation_units u
JOIN sys.partitions p on u.container_id = p.hobt_id

JOIN sys.tables t on p.object_id = t.object_id

GROUP BY
t.object_id,
OBJECT_NAME(t.object_id),
u.type_desc
ORDER BY
Used_Space_kb desc,
ObjectName;
Posted
Updated 30-Jul-22 4:11am

1 solution

This looks like a good description: Determine Free, Used and Total Space for SQL Server Databases[^]

Btw, you will find a lot of other tips when googling for your topic 'How to check the free space of a database of SQL server'
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900