Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 database size
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Yak Posting Veteran

79 Posts

Posted - 03/26/2013 :  10:18:36  Show Profile  Reply with Quote
Select fileid,groupid,size,maxsize,growth,
name,filename from dbo.sysfiles

fileid groupid size maxsize growth name filename
1 1 1966080 6236160 64000 DB_VIEWS Data.MDF
2 0 655360 1310720 131072 DB_VIEWS Log.LDF

database_name database_size unallocated space
DB_VIEWS 20480.00 MB 1901.50 MB

reserved data index_size unused
13781504 KB 9183168 KB 4593976 KB 4360 KB

I dont know how to corelate these two information sources
I just want to know what is the size of my database ,how much has been occupied and how much free space is still available

Only thing I have been able to correlate so far is
data + index_size + unused = reserved (This is onlt from Sp_Spaceused)

Most Valuable Yak

15732 Posts

Posted - 03/26/2013 :  10:52:53  Show Profile  Visit robvolk's Homepage  Reply with Quote
Try this one instead:
SELECT DB_NAME() DB, FILE_ID, name, physical_name, SIZE/128 TotalMB, FILEPROPERTY(name,'SpaceUsed')/128 UsedMB 
FROM sys.database_files
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000