Very handy script.
Note: I have a few databases with spaces in the name of the database. This frequently trips up scripts but yours is easy to enhance for such a situation. Simply change below line:
, SU.name,SO.name from '+@dbname+'.dbo.sysobjects SO join '+@dbname+'.dbo.sysusers SU
to:
, SU.name,SO.name from ['+@dbname+'].dbo.sysobjects SO join ['+@dbname+'].dbo.sysusers SU
Thanks for sharing your code.
-Mike
Mike