December 2, 2011 at 2:54 am
Hello,
I' m looking for t-sql code to obtain all tables size within instance.
I tried to look on internet and found couple of script to get list of all tables per instance, but cant find size of each table per database plus per instance in one code.
Thank you in advance for your help.:-)
Regards
J.
December 2, 2011 at 2:58 am
Query sys.dm_db_index_physical_stats. There's a column page_count. A page is 8kb.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
December 2, 2011 at 3:10 am
Thanks for your input.
Im looking for something like this : sp_msforeachdb 'select "?" AS db, * from [?].sys.tables' plus SIZE of particular talbes.
Thanks.
J.
December 2, 2011 at 3:19 am
Why? The DMV I mentioned is instance-wide and can give you the page count per table and index. You can use Object_Name with the second parameter to get the table name.
If you want the rest of the details then you'll have to use sp_MSForEachDB. You can still use the DMV, just join it to sys.tables.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
December 2, 2011 at 4:11 am
This should do the trick:
http://www.sqlservercentral.com/Forums/FindPost986064.aspx
-- Gianluca Sartori
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply