SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 database size
 New Topic  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

15729 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  
 New 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.03 seconds. Powered By: Snitz Forums 2000