Size of a single Record ? SQL

后端 未结 5 1406
名媛妹妹
名媛妹妹 2021-02-05 11:31

I have a scenario where every user has been allocated 2 MB of database space. Now I have to show Percenatge usage of their allocated space, to do so I need to know the size of s

5条回答
  •  生来不讨喜
    2021-02-05 11:52

    You can calculate the size a row (of number of rows) with a fairly complex formula. See Books Online (ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/81fd5ec9-ce0f-4c2c-8ba0-6c483cea6c75.htm) for the exact details.

    In short:

    Take the number of columns and determine the size of each column by its datatype for fixed-length datatypes.

    Calculate the space used for any nullable columns Then calculate the rowspace:

    Row_Size = Fixed_Data_Size + Variable_Data_Size + Null_Bitmap + 4

提交回复
热议问题