I'm figuring out the best way to estimate the size of a table, for which, I have gone through so much and unable to identify the theoretical space being used for a single row in bytes as the data is saved across pages which are at least 8KB per page and the ROW which we insert is stored across many pages.
Help me to calculate the theoretical space being used for below table
+-------------+--------------------+------+-----+---------+
| Field | Type | Null | Key | Default |
+-------------+--------------------+------+-----+---------+
| Id | int | NO | PRI | |
| Idx | [datetimeoffset](7)| NO | PRI | |
| Val1 | float | YES | | |
| Val2 | float | YES | | |
+-------------+--------------------+------+-----+---------+
you may use the stored procedure sp_estimate_data_compression_savings This is a way diverted from the way it is used, but perhaps the easiest way to get a result when it comes to the size of an object on disk
use TEST
EXEC sp_estimate_data_compression_savings 'dbo','client',NULL,NULL,'row'
Result -->
object_name schema_name index_id partition_number size_with_current_compression_setting(KB)
client dbo 0 1 16 <-- Size of your table
As you asked 'calculate the theoretical space being used for below table' This is it