How to count total number of stored procedure and tables in SQL Server 2008

后端 未结 7 1543
刺人心
刺人心 2020-12-24 06:40

I have database Test1 in SQL Server 2008 R2. On the live server I took backup from there and restore it at our local machine as Test2 and added som

7条回答
  •  时光取名叫无心
    2020-12-24 07:05

    Use this script. It is not using switch case statement.

    USE [MyDatabase]
    GO
    select distinct type_desc as 'Type Description', Count from
    (SELECT 'Count' = COUNT(*), type FROM sys.objects GROUP BY type) as dbstatistics 
    left join sys.objects on dbstatistics.type = sys.objects.type ORDER BY Count desc
    GO
    

提交回复
热议问题