[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Calculate Size of SQL Server 2008 DB

Posted on 2013-01-14
4
Medium Priority
?
380 Views
Last Modified: 2013-03-07
Hi Experts,
How to calculate total size of SQL Server 2008 DB with breakdown for tables , indexes etc

thank a lot
0
Comment
Question by:juliakir
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 30

Accepted Solution

by:
Brad Howe earned 1000 total points
ID: 38774780
Simpe TSQL to get this info for you.

http://gallery.technet.microsoft.com/Determine-size-of-database-6c5373cd


USE BizTalkDTADb --You can change this to desires database
GO

SET NOCOUNT ON
DBCC UPDATEUSAGE(0)
-- DB size.
EXEC sp_spaceused
-- Table row counts and sizes.
CREATE TABLE #t
(
[name] NVARCHAR(128)
, [rows] CHAR(11)
, reserved VARCHAR(18)
, data VARCHAR(18)
, index_size VARCHAR(18)
, unused VARCHAR(18)
)
INSERT #t EXEC sp_msForEachTable 'EXEC sp_spaceused ''?'''
SELECT [name] as 'Table name'
, [rows] as 'Rows'
, cast(replace(reserved, ' KB', '') as bigint) as 'reserved (KB)'
, cast(replace(data, ' KB', '') as bigint) as 'data (KB)'
, cast(replace(index_size, ' KB', '') as bigint) as 'index_size (KB)'
, cast(replace(unused, ' KB', '') as bigint) as 'unused (KB)'
FROM #t
-- # of rows.
SELECT SUM(CAST([rows] AS int)) AS [rows]
FROM #t
DROP TABLE #t
GO


Cheers,
Hades666
0
 
LVL 35

Expert Comment

by:David Todd
ID: 38796005
Hi,

From SSMS, in Object Explorer, Right click on the database, select Reports, select Standard Reports, Select Disk Usage by Table.

Enjoy.

Regards
  David
0
 

Author Comment

by:juliakir
ID: 38911794
David ,
that is nice feature ! What kind of privelegies developer should have in order to be able to do that ?

thank you
0
 
LVL 35

Assisted Solution

by:David Todd
David Todd earned 1000 total points
ID: 38912334
0

Featured Post

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is basically a blog post I wrote recently. I've found that SARGability is poorly understood, and since many people don't read blogs, I figured I'd post it here as an article. SARGable is an adjective in SQL that means that an item can be fou…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question