Here is one way I have found in order to get all tables space used. Effectively it queries the sp_tables and sp_spacedused in a loop to return the data.
Declare
----------------------------------------------------------------------------- Create a temporary table for storing result of sp_tables---------------------------------------------------------------------------
Create
CREATE
----------------------------------------------------------------------------- Populate Temporary table with the results of the sp_tables command-- NOTE: the paramater passed to sp_spaceused MUST be the name of a -- valid table---------------------------------------------------------------------------
Insert
----------------------------------------------------------------------------- Create cursor for selecting the Table names---------------------------------------------------------------------------
-- Open the cursor defined above
Open
Fetch
While
End
SELECT
----------------------------------------------------------------------------- Clean up (drop temp tables, remove cursors)---------------------------------------------------------------------------
drop