• SanDroid,

    You are right about the order. The columns types where still character because that is how sp_spaceused returnsthem. I updated the code with a a select that converts them to numbers without the trailing "KB" text, the order is set for row counts.

    To get the total space used by a table you have to add the 4 KB columns together and order by the result. At least that is my theory.

    Its does run longer than I would like for the 6,000+ tables in the instance I test with.

    David Bird