I need a scripts/procedure that will show the following ;
Alias ; 0
Table ; 10
Index ; 4
Constraint ; 9
etc for ALL the object types.
(Selecting from sysobjects does not give all the info)
You can use the sql query below and instead of else you can add when conditions to get your count for the rest of object types.
SELECT CASE
WHEN type = 'P' Then 'Procedures'
WHEN type = 'U' Then 'User Tables'
WHEN type = 'S' Then 'System Tables'
WHEN type = 'V' Then 'Views'
WHEN type = 'TR' Then 'Triggers'
WHEN type = 'XP' Then 'Extended Stored Procedures'
WHEN type = 'RI' Then 'Refrential Constraint'
ELSE 'Others'
END
AS Objects,
COUNT(type) AS Occurs
FROM sysobjects GROUP BY type
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.