Bytes per row

  • I have a table with several columns and data types. I am looking for assistance on how I can query this table to calculate the total number of bytes created for this table.

    -JG

    -JG


    -JG

  • Are you talking about across the column or the total number of bites the table takes up? If the later you can run

    sp_MStablespace 'TableNameHere' and you will get a return of

    ROWS = number of rows of data

    DataSpaceUsed = Total size of table (divide it by 8 and it will tell you how many pages the table lives on since a papge is 8k)

    IndexSpaceUsed = similar to DataSpaceUsed but is a total for all the indexes.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

  • I am looking for accros the column.

    -JG


    -JG

  • This should handle it then for the row

    select sum(length) as totalbytesforrow from syscolumns where [id] = object_id('tablenamehere')

    Just run in the database in question.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

  • You got it going on man! I was looking into the Views but it was not showing the int or smallmoney bytes the sys table had all that.

    Thanks - JG

    -JG


    -JG

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply