In this example we will shrink the size of a Microsoft SQL Database. We do this by using the command DBCC SHRINKFILE. To find out the size of a database use the stored procedure sp_spaceused
In this example we will get the sizes of each table within an Microsoft SQL database. We do this by creating a temporary table and then running the stored procedure sp_MSforeachtable to call the stored procedure sp_spaceused, insert the output into the temporary table and then select the results.