Lots of good feedback, I have received on my recent to the point blog posts. Today we will see a script for Available Free Space in Data and Log File.
Here is the script which you can run to identify the Total and Free space in your database files.
SELECT [File Name] = name, [File Location] = physical_name, [Total Size (MB)] = size/128.0, [Available Free Space (MB)] = size/128.0 - CAST(FILEPROPERTY(name, 'SpaceUsed') AS INT)/128.0, [Type] = type_desc FROM sys.database_files;
Well, that’s it. We are done. You run the script above and it will give you available free space in data and log files for your current database. If you have any other questions or comments, you can reach out to me via comment.
Is your SQL Server running slow and you want to speed it up without sharing server credentials? In my Comprehensive Database Performance Health Check, we can work together remotely and resolve your biggest performance troublemakers in less than 4 hours.
If you liked this blog, please do not forget to subscribe to my YouTube Channel – SQL in Sixty Seconds.
Here are my few recent videos and I would like to know what is your feedback about them.
- Queries Using Specific Index – SQL in Sixty Seconds #180
- Read Only Tables – Is it Possible? – SQL in Sixty Seconds #179
- One Scan for 3 Count Sum – SQL in Sixty Seconds #178
- SUM(1) vs COUNT(1) Performance Battle – SQL in Sixty Seconds #177
- COUNT(*) and COUNT(1): Performance Battle – SQL in Sixty Seconds #176
Reference: Pinal Dave (http://blog.SQLAuthority.com)
Really interested to know why you have written the SQL in this old-school fashion of [Alias] = column rather than column as [Alias] ?