Solved

sp_spaceused

Posted on 2013-06-10
6
268 Views
Last Modified: 2013-06-12
I am monitoring my table size using this stored procedure:

sp_spaceused 'tableName'


But, I don't have enough experience to know how to put it into a table in sql so I can monitor trends.  Can you help please?
0
Comment
Question by:mathburg
[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
6 Comments
 
LVL 75

Assisted Solution

by:Aneesh Retnakaran
Aneesh Retnakaran earned 100 total points
ID: 39236146
0
 
LVL 49

Assisted Solution

by:PortletPaul
PortletPaul earned 100 total points
ID: 39236286
here's a simple script:
http://www.cryer.co.uk/brian/sqlserver/howto_list_table_sizes.htm

in that example the result table is dropped - but that can be amended to suit
0
 
LVL 13

Assisted Solution

by:sameer2010
sameer2010 earned 100 total points
ID: 39237035
Here is what you can do. Create the table to hold the data and remove drop and create from subsequent executions.
drop table #t
create table #t(name varchar(100),rows varchar(100),reserved varchar(100),data varchar(100),index_size varchar(100),unused varchar(100),currTime datetime default getdate())

insert into #t (name,rows,reserved,data,index_size,unused)
exec sp_spaceused N'avgtable'

select * from #t

Open in new window

0
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
LVL 21

Accepted Solution

by:
Alpesh Patel earned 100 total points
ID: 39237379
Sorry, Before submit my code someone has already posted.



create table #temp
(
name varchar(max),
rows varchar(max),
reserverd varchar(max),
data varchar(max),
index_size varchar(max),
unused varchar(max)
)
GO
sp_msforeachtable 'insert into #temp (name,rows,reserverd, data, index_size, unused)  exec sp_spaceused ''?'''
GO
select * from #temp
GO
0
 
LVL 2

Assisted Solution

by:vivekkumarSharma
vivekkumarSharma earned 100 total points
ID: 39238152
create table test1_spaceused(name varchar(20),rows int,reserved varchar(20),data varchar(20),index_size varchar(20),unused varchar(20))

insert into test1_spaceused
exec sp_spaceused 'test1'

select * from test1_spaceused
0
 

Author Closing Comment

by:mathburg
ID: 39238512
The last three answered my question well.  
Thank you so much.  aneeshattingal , The link did not work for me.  I'm sure it was probably the same thing sorry.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

After restoring a Microsoft SQL Server database (.bak) from backup or attaching .mdf file, you may run into "Error '15023' User or role already exists in the current database" when you use the "User Mapping" SQL Management Studio functionality to al…
In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

696 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