Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

passing a parameter to system stored procedure

Posted on 2009-05-15
4
Medium Priority
?
230 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
  • 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

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Question has a verified solution.

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

Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

916 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