1 . Exec Sp_spaceused ' Table Name ' -- (SQL statistics, which may be inaccurate after a large number of transaction operations)
2 . Exec Sp_spaceused ' Table Name ' , True -- (Update the space size of the table. The exact empty size of the table may take some statistical time)
3 . Exec Sp_spaceused -- (Database size query)
4 . Exec Sp_msforeachtable" Exec Sp_spaceused ' ? ' " -- (Any user tablespace table is small, SQL statistics, and may not be allowed after a large number of transaction operations)
5 . Exec Sp_msforeachtable" Exec Sp_spaceused ' ? ' , True" -- (Any user tablespace table is small, and large databases should be used with caution)
You can view the temporary table.
Create Table # Temp
(
Name Varchar ( 255 ),
Rows Bigint ,
Reserved Varchar ( 20 ),
Data Varchar ( 20 ),
Index_size Varchar ( 20 ),
Unused Varchar ( 20 )
)
Exec Sp_msforeachtable" Insert Into # Temp Exec Sp_spaceused ' ? ' "
Select * From # Temp Order By Data Desc -- Sort by size
Drop Table # Temp
View the data file and Log File Size
-- Database size
Sp_helpdb Database Name
--Log Size
DBCC sqlperf (logspace)