Get all Table Sizes

These script creates two procedures (usp_GetTableSizes and sp_SpaceUsed2) in the user database. The first procedure Usp_GetTableSizes reports each user table in the database along with it’s data size and the number of data rows it has. Usp_GetTableSizes uses the second store procedure sp_spaceused2 to collect metadata. Sp_spaceused2 is a slightly modified version of the system stored procedure sp_spaceused. It returns tablenames that are longer than 20 characters. The sp_spaceused system stored procedure currently shows only the first 20 characters of a table name.

Author: Neil Mederich

Download Script:
usp_GetTableSize.SQL



Disclaimer:
We hope that the information on these script pages is
valuable to you. Your use of the information contained in these pages,
however, is at your sole risk. All information on these pages is provided
“as -is”, without any warranty, whether express or implied, of its accuracy,
completeness, or fitness for a particular purpose…

Disclaimer Continued

Back to Database Journal Home

Get the Free Newsletter!

Subscribe to Cloud Insider for top news, trends & analysis

Latest Articles