Great script. However I would get this error on some of my databases:
Msg 15009, Level 16, State 1, Procedure sp_spaceused, Line 62
The object 'tbl_Mine' does not exist in database 'Test' or is invalid for this operation.
The problem occurs when the table has a schema other than dbo associated with it. sp_spaceused will throw the error unless you include the schema like sp_spaceused 'payroll.tbl_Mine'
I modified just one line of your code to prevent this error. Here is your code followed by my edit:
Original:
declare tblname CURSOR for select name from sysobjects where xtype='U'
Editted:
declare tblname CURSOR for select OBJECT_SCHEMA_NAME(id) + '.' + name from sysobjects where xtype='U'
Thanks again for sharing this script.
Lee