Oto odpowiedź znaleziona na stronie SQLServerCentral.com. Istnieje kilka różnych skryptów dostarczanych przez różnych użytkowników na tej stronie. Być może jeden z nich zapewni to, czego szukasz.
http://www.sqlservercentral.com/Forums/Topic670489-146-1.aspx
Oto jeden ze skryptów z Manu-J:
Create TABLE #db_file_information(
fileid integer
, theFileGroup integer
, Total_Extents integer
, Used_Extents integer
, db varchar(30)
, file_Path_name varchar(300))
-- Get the size of the datafiles
insert into #db_file_information
(fileid
, theFileGroup
, Total_Extents
, Used_Extents
, db
, file_Path_name)
exec sp_MSForEachDB 'Use ?; DBCC showfilestats'
-- add two columns to the temp table
alter table #db_file_information add PercentFree as
((Total_Extents-Used_Extents)*100/(Total_extents))
alter table #db_file_information add TotalSpace_MB as
((Total_Extents*64)/1024)
alter table #db_file_information add UsedSpace_MB as
((Used_Extents*64)/1024)
alter table #db_file_information add FreeSpace_MB as
((Total_Extents*64)/1024-(Used_Extents*64)/1024)
select * from #db_file_information
drop table #db_file_information
Dokładnie tego szukałem, dzięki. Domyślam się, że dla SQL Server 2000 będę musiał użyć kodu @ jennifer-s, prawda? – olmed0
Dziękuję. Prosty i użyteczny. –