Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 234
  • 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

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