Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to check data size? 1

Status
Not open for further replies.

babeo

Technical User
Mar 30, 2000
398
CA
Hi
I usually issue sp_databases to check the size of the databases. However, I have this question first before asking the real question I need to know:
1) is there 2 types of data in 1 database? are they log and data?

2)According to the first question, this is my real question: If it so (means 2 types of data in 1 database), then how can I check the size for logs and for data seperately because sp_databases only give me the number in whole of both, I believe so.

Thanks.
 
hello,

try sp_helpdb {database name}...
and sp_spaceused...

q.
 
This will give you your DB Size in MB...

select "DBSize Meg" = sum( round( (a.low * convert(float, u.size)) / 1048576, 1)),
"DBSpaceUsed Meg" =sum( round( (a.low * convert(float, u.size)) / 1048576, 1)) - sum((curunreservedpgs(u.dbid, u.lstart, u.unreservedpgs) * 2/ 1024.0))
from master.dbo.sysdatabases d,
master.dbo.sysusages u,
master.dbo.sysdevices v,
master.dbo.spt_values a,
master.dbo.spt_values b
where d.dbid = u.dbid
and v.low <= u.size + vstart
and v.high >= u.size + vstart - 1
and v.status & 2 = 2
and d.name = &quot;TYPE YOUR DB NAME HERE&quot;
and a.type = &quot;E&quot;
and a.number = 1
and b.type = &quot;S&quot;
and b.number = 7
order by 1
go
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top