Library code snippets
Calculate Diskspace Used by a Table or Database
Ever wondered how much storage space a particular table in your SQL Server database takes up? It's actually *really* easy to find out! Simply do
EXEC sp_spaceused 'tablename'
where tablename is the table you're interested in, and you'll get back something that looks like this:
| names | rows | reserved | data | index_size | unused |
|---|---|---|---|---|---|
| dir_pages |
4308 | 13088 KB | 12928 KB | 88 KB | 72 KB |
If you omit the 'tablename' parameter, then you'll get back two resultsets with information about the entire database:
| database_name | database_size | unallocated space |
|---|---|---|
| devfusion |
11248.69 MB | 18.52 MB |
| reserved | data | index_size | unused |
|---|---|---|---|
| 87856 KB | 81232 KB | 5152 KB | 1472 KB |
Related articles
Related discussion
-
How to Databind PictureBox to database
by amazingpeople (0 replies)
-
Java Based Mobile Development Tool Now Supports Wireless PDA Access To SQL Server Databases
by mobiforms (0 replies)
-
Access SQL Server From Any Mobile PDA
by mobiforms (0 replies)
-
index out of range
by diwa.net (2 replies)
-
Index out of Range
by kausar4u (4 replies)
Related podcasts
-
Stack Overflow: Podcast #28
This is the twenty-eighth episode of the StackOverflow podcast, where Joel and Jeff discuss Windows Azure, SQL Server 2008 full text search, Bayesian filtering, porn detection, and project management — among other things. Jeff met the inestimable Joey DeVilla aka Accordion Guy...
Related jobs
-
Microsoft .Net Architect
in AMSTERDAM (€50K-€90K per annum) -
Ervaren SAP Basis Consultant
in Amsterdam (€50K-€90K per annum) -
Microsoft Dynamics CRM Consultant (Senior)
in Netherlands (€50K-€90K per annum) -
Microsoft Dynamics CRM Technical Consultant
in Netherlands (€50K-€90K per annum)
Events coming up
-
Mar
23
DevWeek 2009
London, United Kingdom
DevWeek is Europe’s leading independent conference for software developers, database professionals and IT architects, and features expert speakers on a wide range of topics, including .NET Framework 4.0, Silverlight 2, WCF 4.0, Visual Studio 2010, RESTful services, Windows Workflow, ASP.NET AJAX 4.0, SQL Server 2008, LINQ, C# 3, .NET Patterns, Ruby, and more.
usefull info
Thanks james
This thread is for discussions of Calculate Diskspace Used by a Table or Database.