Solved

sp_spaceused

Posted on 2013-06-10
6
267 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 48

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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

738 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