What is the purpose of
select id, xtype from master.sys.sysobjects
is sys.objects not sufficient ?
Also would it better to change the join order i.e. if we are after permissions should we be using database_permissions as the base table.This will prevent nulls being returned where database roles have no explicitly defined permissions ?
We could just use where Permission is not null I guess.
Lastly how can we get schema names to appear under the object name column ? I am seeing the following permissions ;
VIEW CHANGE TRACKING
with no object name. Clearly it applies to a schema but it would be useful to get the schema name.