• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 232
  • Last Modified:

passing a parameter to system stored procedure

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
ali_alannah
Asked:
ali_alannah
  • 2
  • 2
1 Solution
 
Aneesh RetnakaranDatabase AdministratorCommented:
sp_MSForEachTable " sp_SpaceUsed '?' "
0
 
ali_alannahAuthor Commented:
Hi aneeshattingal:
i tried your hint ,it worked , but what if i need the result in one resulset?
0
 
Aneesh RetnakaranDatabase AdministratorCommented:
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
 
ali_alannahAuthor Commented:
Thanks
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now