SQL Query to get objects count in database


select
count(*),
case
xtype when 'P' then 'Stored Procedure'
when
'C' then 'CHECK constraint'
when
'D' then 'DEFAULT constraint'
when
'F' then 'FOREIGN KEY constraint'
when
'L' then 'Log'
when
'PK' then 'PRIMARY KEY constraint'
when
'RF' then 'Replication filter stored procedure'
when
'S' then 'System table'
when
'TR' then 'Trigger'
when
'U' then 'User table'
when
'UQ' then 'UNIQUE constraint'
when
'V' then 'View'
when
'X' then 'Extended stored procedure'
when
'FN' then 'Function'
when
'IF' then 'In-lined table-function '
when
'SQ' then 'Service queue'
when
'IT' then 'Internal table'
when
'TF' then 'Table function'
else
xtype end
from
sysobjects group by xtype