Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

passing a parameter to system stored procedure

Posted on 2009-05-15
4
Medium Priority
?
221 Views
Last Modified: 2012-05-07
I use the stored procedure
sp_spaceused tablename
to get the space for a table
but i have 135 table in my DB
 select name from sys.tables
, so i need to make a loop for the result set for the previous select , an pass the table name to the SPSpaceused to get space used by each table



select name from sys.tables

Open in new window

0
Comment
Question by:ali_alannah
[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 75

Expert Comment

by:Aneesh Retnakaran
ID: 24399846
sp_MSForEachTable " sp_SpaceUsed '?' "
0
 

Author Comment

by:ali_alannah
ID: 24399965
Hi aneeshattingal:
i tried your hint ,it worked , but what if i need the result in one resulset?
0
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 2000 total points
ID: 24399999
create a temptable with exactly the same structure that the sp_SpaceUsed 'tableName' returns, (Same no of columns and datatype )
then use this

INSERT INTO #Temp
EXEC sp_MSForEachTable " sp_SpaceUsed '?' "
0
 

Author Closing Comment

by:ali_alannah
ID: 31582119
Thanks
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

There are some very powerful Dynamic Management Views (DMV's) introduced with SQL 2005. The two in particular that we are going to discuss are sys.dm_db_index_usage_stats and sys.dm_db_index_operational_stats.   Recently, I was involved in a di…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
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.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

722 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