April 20, 2010 at 5:11 pm
I'm Using the below script in SQL Agent & running daily as a job, which writes the data file & log file used space & free space in the text file.
sp_msforeachdb 'USE [?]
select Name,
(convert(float,size)) * (8192.0/1048576) File_Size,
(convert(float,fileproperty(name,''SpaceUsed''))) * (8192.0/1048576) MB_Used,
((convert(float,size)) * (8192.0/1048576) - (convert(float,fileproperty(name,''SpaceUsed''))) * (8192.0/1048576)) MB_Free
from sysfiles
order by
fileproperty(name,''IsLogFile'')'
Now I want use the above script for just one database & NOT for all databases.
What should I change in the above script to just get the size for the required database?
Thanks
April 20, 2010 at 5:24 pm
gmamata7 (4/20/2010)
I'm Using the below script in SQL Agent & running daily as a job, which writes the data file & log file used space & free space in the text file.sp_msforeachdb 'USE [?]
select Name,
(convert(float,size)) * (8192.0/1048576) File_Size,
(convert(float,fileproperty(name,''SpaceUsed''))) * (8192.0/1048576) MB_Used,
((convert(float,size)) * (8192.0/1048576) - (convert(float,fileproperty(name,''SpaceUsed''))) * (8192.0/1048576)) MB_Free
from sysfiles
order by
fileproperty(name,''IsLogFile'')'
Now I want use the above script for just one database & NOT for all databases.
What should I change in the above script to just get the size for the required database?
Thanks
USE [YourDBNameHere]
select Name,
(convert(float,size)) * (8192.0/1048576) File_Size,
(convert(float,fileproperty(name,'SpaceUsed'))) * (8192.0/1048576) MB_Used,
((convert(float,size)) * (8192.0/1048576) - (convert(float,fileproperty(name,'SpaceUsed'))) * (8192.0/1048576)) MB_Free
from sysfiles
order by
fileproperty(name,'IsLogFile')
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply