Is there any way to find out how much diskspace a table in MSSQL uses? Or even better, how much diskspace a single row consumes?
Is there any way to find out how much diskspace a table in MSSQL uses? Or even better, how much diskspace a single row consumes?
In SQL Server Management Studio, right click on the Database and choose Reports|"Disk Usage By Tables".
Also, I don't know what version of SQL Server it was introduced in, but there is a sproc sp_spaceused that you can pass an object; For example:
For a table you can use
sp_spaceused
to determine the size of the table. However, any schema with variable length columns such as varchar/varbinary types will not have a fixed row size. Given that this describes most if not all real databases, you are really only going to be interested in an average row size which can be trivially calculated by dividing the size by the row count.In the management studio, you can right click on the database and go to properties. It will have a size field that will tell you the size of the current database.
In SQL Server Management Studio, right-click on the table, select "Properties" and move to the "Storage" page.
Somewhat related - this script could be useful: Finding the biggest tables in a database