forX
forX

Reputation: 2153

SQL Server : statistic of each database, How much each db is used

I want statistic of each database in a SQL Server instance.

For each database, I want to know how many triggers, stored procedures, etc.

Maybe also link between databases.

Any stat useful for migration, usage report, statistical development.

Upvotes: 1

Views: 196

Answers (2)

SteveB
SteveB

Reputation: 1514

This will do exactly what you need

EXECUTE master.sys.sp_MSforeachdb 'USE [?]; EXEC sp_spaceused'

This link gives you more details

There are a few other undocumented stored procedures, one for tables for example, that are useful.

Upvotes: 0

marc_s
marc_s

Reputation: 754220

Have a look at the Catalog Views in SQL Server - they tell you pretty much everything.

Number of triggers?

 SELECT COUNT(*) FROM sys.triggers

Number of stored procedures?

 SELECT COUNT(*) FROM sys.procedures

and so on - the possibilities are endless.....

Upvotes: 1

Related Questions