How to size table by number of rows in SQL Server -


i have table want size of number records based on byte in sql server:

enter image description here

the answer related this question can suggest this:

select     s.name schemaname,     t.name tablename,     p.rows rowcounts,     a.total_pages * 8 totalspacekb,     a.used_pages * 8 usedspacekb,     a.total_pages * 8 / p.rows eachrowtotalspacekb,     a.used_pages * 8 / p.rows eachrowusedspacekb,     a.total_pages * 8 / p.rows * (select * dbo.picturetable schoolcode=1001) querytotalspacekb,     a.used_pages * 8 / p.rows * (select * dbo.picturetable schoolcode=1001) querytotalspacekb      sys.tables t inner join           sys.indexes on t.object_id = i.object_id inner join      sys.partitions p on i.object_id = p.object_id , i.index_id = p.index_id inner join      sys.allocation_units on p.partition_id = a.container_id left outer join      sys.schemas s on t.schema_id = s.schema_id      s.name = 'dbo' ,     t.name = 'picturetable'; 

edit
can length of data in field using datalength this:

select sum(datalegth(picturetable_id)) + sum(datalegth(groupcourses_id)) +sum(datalegth(per_id)) + sum(datalegth(school_id)) + sum(datalegth(academicyear_id)) + sum(datalegth(picturetable_description)) + sum(datalegth(schoolcode)) rowsizes picturetable (schoolcode = 1001); 

Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -