July 2, 2009 at 12:03 am
Hi friends,
I have set of tables..
need to give the estimated DB size,
and need to find the single row size in a table...
or estimated table size..
Can u plz provide the strategy to find the perfect answers..
Thanks in Advance..
Ganesh
GaNeSH
July 2, 2009 at 12:10 am
There are many scripts here. you may want to start with this one.
http://www.sqlservercentral.com/articles/Administration/findingtablespace/1936/%5B/url%5D
To find the estimate table size there is a formula
rows per page = 8096/row size
row size = fixed data size+ variable data size + null bitmap + row header
variable data size = 2+(number of variable cols X2)+max var size
null bitmap= 2+((number of columns +7)/8)
you can then find the table space requirement accordingly
number of pages=number of rows/rows per page
total size = number of pages X 8 KB
EDIT - Row header is always 4 bytes
July 2, 2009 at 12:12 am
That link gives an error.."The specified request cannot be executed from current Application Pool"
not opening.
GaNeSH
July 2, 2009 at 12:18 am
you can find estimated table size using the formula i mentioned.
Yep i too tried to run that query and gave that error.
you can query this to get row count and size only for each table from the example in that link
select * from #SpaceUsedByObjectForDpage
July 2, 2009 at 12:38 am
If i am not wrong you are looking for the current size of all the objects in a Database and current size of all the tables in a database .
You can try this :
sp_msforeachtable 'sp_spaceused "?"'
[You need to run this in each database]
sp_msforeachdb '?.dbo.sp_spaceused'
[Run this in any database and it will show you the size of all the databases]
Regards
Abhay Chaudhary
Sr.DBA (MCITP/MCTS :SQL Server 2005/2008 ,OCP 9i)
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply