Something like this should suffice. I'm not sure what the "D" object type is on sysobjects :-(
set nocount on
select case type
when 'D' then 'Whats This?'
when 'P' then 'Stored Procs'
when 'R' then 'Rules'
when 'S' then 'System Tables'
when 'TR' then 'Triggers'
when 'U' then 'Tables'
when 'V' then 'Views'
else 'Other'
end, count(*)
from sysobjects
group by type
select 'Indexes', count(*)
from sysindexes
select 'Constraints', count(*)
from sysconstraints
Here's the SQL for the full list of object types in sysobjects ...
set nocount on
select case type
when 'D' then 'Default'
when 'L' then 'Log'
when 'P' then 'Procedure'
when 'PR' then 'Prepare Object'
when 'R' then 'Rule'
when 'S' then 'System Table'
when 'TR' then 'Trigger'
when 'U' then 'User Table'
when 'V' then 'View'
when 'RI' then 'Referential Constraint'
when 'XP' then 'Extended Stored Procedure'
end, count(*)
from sysobjects
group by type
select 'Indexes', count(*)
from sysindexes
select 'Constraints', count(*)
from sysconstraints
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.