Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

MSSQL administration

Posted on 2004-10-28
4
Medium Priority
?
466 Views
Last Modified: 2008-03-06
MSSQL administration

Summary:
Need a way to get a summary dashboard view of various table stats in MSSQL.

Details:
For example comparing against - MySql + phpmyadmin -
gives a nice overview of database stats.
For each table - rowcounts, bytes, etc.
What is a good way to get similar dashboard stats for MSSQL database?
I found sp_databases and sp_help
I was going to start wrinting something to pull stuff from dbo.sysobjects,
but I believe there may be solutions out there already.

Looking for good advice.
0
Comment
Question by:weinerk
[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
  • 2
4 Comments
 
LVL 8

Expert Comment

by:SashP
ID: 12436746
Hi weinerk

sp_spaceused [table name]

will give you the results that that you are looking for

Cheers Sash
0
 
LVL 8

Accepted Solution

by:
SashP earned 1000 total points
ID: 12436875
weinerk,

By definition, sp_spaceused only accepts a single object as a parameter.But in this case you can use the undocumented call sp_MSforeachtable as in:
EXEC sp_MSforeachtable 'sp_spaceused ''?'''
Or an alternative approach would be to write a cursor to loop through the number of tables and execute the sp_spaceused against each.

You can also store the info in a table for later analysis as illustrated in this example...

CREATE TABLE #TemptableforspaceUsed
(name SYSNAME,
rows INT,
reserved VARCHAR(10),
data VARCHAR(10),
index_size VARCHAR(10),
unused VARCHAR(10))
 
INSERT #TemptableforspaceUsed
EXEC sp_MSforeachtable 'sp_spaceused ''?'''

select * from #TemptableforspaceUsed
0
 
LVL 1

Author Comment

by:weinerk
ID: 12436962
Thanks, once I got that I found this:
http://www.tkdinesh.com/faq/ans/spsumult.html

Q:Can the stored procedure sp_spaceused be used on multiple tables at a time?

A:By definition, sp_spaceused only accepts a single object as a parameter.But in this case you can use the undocumented call sp_MSforeachtable as in:
EXEC sp_MSforeachtable 'sp_spaceused ''?'''
Or an alternative approach would be to write a cursor to loop through the number of tables and execute the sp_spaceused against each.

You can also store the info.in a table for later analysis as illustrated in this example...

CREATE TABLE #TemptableforspaceUsed
(name SYSNAME,
rows INT,
reserved VARCHAR(10),
data VARCHAR(10),
index_size VARCHAR(10),
unused VARCHAR(10))
GO
INSERT #TemptableforspaceUsed
EXEC sp_MSforeachtable 'sp_spaceused ''?'''

0
 
LVL 1

Author Comment

by:weinerk
ID: 12436988
Funny I found the same page :-)))))
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

610 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