|sp_dbinfo - show space usage for all databases|
About me and Nucleus
Articles, tips etc.
Courses and training
One of the first things I want to do when I look at a new SQL Server is to get an idea of space usage details for each database, as well as total.
See comment block in procedure source code for version history of the procedure.
The procedure returns a row for each database plus one row for all databases. You get the name of the database, data space allocated, data space used, log space allocated and log space used. All units are MB. The procedure accepts two parameters, both optional.
@sort is used for sorting the result. The value is a single letter:
@include_instance_name ('y' or 'n') specified whether to include the instance name in the result set.
You find the code here