March 20, 2002 at 7:45 am
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
March 20, 2002 at 8:05 am
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)
March 20, 2002 at 8:15 am
I am looking for accros the column.
-JG
-JG
March 20, 2002 at 8:26 am
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)
March 20, 2002 at 8:40 am
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