Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6673955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:41:21+00:00 2026-05-26T03:41:21+00:00

I want to use the procedure sp_spaceused on a table. This procedures returns among

  • 0

I want to use the procedure sp_spaceused on a table.
This procedures returns among others the size of the tables.
example:

sp_spaceused

database_name          database_size    unallocated space

db_test 216001.00 MB    196366.74 MB

After I perform a compression I want to recall the function in order to find the compression percentage.

I call again sp_spaceused.

How can I represent database_size internally in order to perform a division?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:41:21+00:00Added an answer on May 26, 2026 at 3:41 am

    You can actually store the results of the stored procedure in a table. Once you have them in a table you can manipulate it however you need. To get stored procedure results into a table, you would first need to make a table with columns that match the resultset of the stored procedure. Then do an insert statement for the table but instead of a query or a value list, execute the stored procedure. Note, that this will only get the first resultset of a stored procedure into a table. For example, you could do:

    create table HoldSpaceUsed
    (
        database_name sysname,
        database_size varchar(100),
        [unallocated space] varchar(100)
    )
    
    insert HoldSpaceUsed
    exec sp_spacesused
    

    After you execute the above statements the HoldSpaceUsed table will contain the stored procedure results. Remember that the database_size field has the ‘MB’ representing the database size is in megabyts, so you would need to trim out the ‘MB’ text so you have just the number and then you can use it however you need.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a procedure which returns a table on the basis of
I want to use LINQ to call stored procedure in this way but stored
How do you a procedure like scope identity with linq want to use it
I have a Stored Procedure which executes some dynamic SQL. I want to use
I have a stored procedure with a username parameter. I want to use one
Below is my stored procedure. I want use stored procedure select all row of
I have a stored procedure that returns a table (or dataset or view or
I use this code to define my stored procedure CREATE PROCEDURE [dbo].[SP] (@Country NVARCHAR(20))
I use stored procedures in Entity Framework. Let's say that I have that procedure:
I want use groovy findAll with my param to filtering closure filterClosure = {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.