Query all database names and their sizes on the machine where the database is located
2. Query the names and sizes of all tables under the database
Please expert guidance!
1. View all database related information, parcel storage path, etc.
Use master
SELECT * FROM Dbo.sysdatabases
2.
A case study of SQL2000 's own pubs
execsp_msforeachtable
@precommand=N'CREATE TABLE # # # (
table name sysname,
Record number int,
Reserved space Nvarchar (10),
Using space varchar (10),
The index uses space varchar (10),
Unused space varchar (TEN))',
@command1=N'Insert # # # EXEC sp_spaceused"'?" ",
@postcommand=N'select * FROM # # # ORDER by record number'
Table name record number of reserved space use spatial index use space unused space
Personaltabs 57011 11208 kb 3280 KB 7728 KB (KB)
Roles 8 KB 8 KB 0 KB
Gradetotal 307-KB 0 KB
CHILDSLAVETABLEDTL 0 8 KB 0 KB 8 KB 0 KB
Smspersonalacount 1 KB 8 KB 8 KB 0 KB
Selectdata 169 136 KB-KB (KB)
Maintable_class 7 KB 8 KB 8 KB 0 KB
SQL Server View all table sizes, occupied space