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

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 database size

Author  Topic 

Kimi86
Yak Posting Veteran

79 Posts

Posted - 2013-03-26 : 10:18:36
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


Sp_Spaceused:-
---------------------
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)


robvolk
Most Valuable Yak

15732 Posts

Posted - 2013-03-26 : 10:52:53
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
   

- Advertisement -