What is the purpose of
[font="Courier New"]select id, xtype from master.sys.sysobjects[/font]
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 [font="Courier New"]where Permission is not null [/font] 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.