Report on each table using sp_spaceused : sp_spaceused « System Functions « SQL Server / T-SQL Tutorial






3>
4> DECLARE @AWTables TABLE (SchemaTable varchar(100))
5> DECLARE @TableName varchar(100)
6>
7> WHILE (SELECT COUNT(*) FROM @AWTables)>0
8> BEGIN
9> SELECT TOP 1 @TableName = SchemaTable FROM @AWTables ORDER BY SchemaTable
10> EXEC sp_spaceused @TableName
11> DELETE @AWTables WHERE SchemaTable = @TableName
12> END
13>
14> WHILE (1=1)
15>     BEGIN
16>         PRINT '1 --- 1'
17>         IF 1=1
18>             BEGIN
19>                 PRINT 'Break up now.'
20>                 BREAK
21>             END
22>         ELSE
23>             BEGIN
24>                 CONTINUE
25>             END
26> END
27> GO
1 --- 1
Break up now.








25.56.sp_spaceused
25.56.1.sp_spaceused reviews the space used by a table in a database.
25.56.2.Report on each table using sp_spaceused