-
MS-SQL(MSDE) How can i see with a select the available database space
Is it possible to select the available space of the database in a microsoft sql MSDE edition?
With sysfiles i can see the size of the database but where can i find the available space or the used space of the database.
-
--For datafile
declare @query varchar(200)
set @query ='DBCC showfilestats'
create table #mytable(Fileid int, FileGroup int, Totalextents bigint,UsedExtents bigint,Name varchar(256),Filename varchar(600))
insert #mytable exec (@query)
select Name,Filename,(TotalExtents*64)/1024 as TotalMB,(Usedextents*64)/1024 as UsedMB,
Free= ((TotalExtents*64) - (Usedextents*64))/1024,
FreePercent=(((TotalExtents*64*1.0) - (Usedextents*64*1.0))/(TotalExtents*64*1.0))*100
from #mytable
drop table #mytable
--For Logfile
dbcc sqlperf(logspace)
-
You can run sp_spaceused to get an estimate. But run dbcc updateusage to get upto date data.
-
Thanks it works perfectly
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|