Database Sizing
Hi,
I need following details of my database what query do i use to fetch such information.
Table Name
Num_Rows
Num_Cols
Fixed_Data_Size in bytes
Num_Variable_Cols
Max_Var_Size
Xyz 2000
5 10000
2 200
To size datbase.
Regards,
NavinNavin.D http://dnavin.wordpress.com
May 21st, 2012 12:14am
select so.name,count(*) Num_Cols , p.[Rows],
sum(sc.length * (1 - st.variable)) Fixed_Data_Size,
sum(cast(st.variable as smallint)) Num_Variable_Cols,
sum(sc.length * st.variable) Max_Var_Size
from sysobjects as so
join syscolumns as sc
on so.id = sc.id
join systypes as st
on sc.xtype = st.xtype
JOIN
sys.indexes i ON so.id = i.object_id
JOIN
sys.partitions p ON i.object_id = p.OBJECT_ID AND i.index_id = p.index_id
where so.xtype='u'
group by so.name, p.[Rows]
order by sum(sc.length * (1 - st.variable)) descNavin.D http://dnavin.wordpress.com
Free Windows Admin Tool Kit Click here and download it now
May 21st, 2012 12:39am


