January 21, 2010 at 7:29 am
Hello Experts
I am willing to know if there is any T-SQL query available to find out the size of the table.
Please assist me in this regard.
Thanks in advance,
Thanks.
January 21, 2010 at 7:57 am
Hi there,
Can you take a look at sp_spaceused and see if it gives all the information you want to know about the table?
José Cruz
January 21, 2010 at 8:05 am
Sourav-657741 (1/21/2010)
Hello ExpertsI am willing to know if there is any T-SQL query available to find out the size of the table.
This is the query
select object_name(s2.id) as TableName,(sum(s1.reserved*8) )TableSize_In_KB,sum(s1.rowcnt) as NumberofRows,
DataSize_KB= case (s1.indid)
when 255 then (((sum(s1.reserved*8)-sum(s1.dpages*8))- (sum(s1.reserved*8)-sum(s1.used*8))) )
else sum(s1.dpages*8)
end ,
IndexSize_KB = case (s1.indid)
when 255 then 0
else (((sum(s1.reserved*8)-sum(s1.dpages*8))- (sum(s1.reserved*8)-sum(s1.used*8))))
end,sum(s1.used*8) UsedSpace_KB,
((sum(s1.reserved*8)-sum(s1.used*8)) )FreeSpace_KB
from sysindexes s1 inner join sysobjects s2
on s1.id = s2.id
where s2.type = 'U' and ((s1.indid = 1) or (s1.indid =0 or s1.indid = 255))
group by s2.id,s1.indid ORDER BY TableSize_In_KB desc
January 21, 2010 at 9:20 am
Thanks Kalyani for your assistance.
I executed the query and found my desired results. [:)]
Thanks.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply