Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin.
Search for scripts directly from SSMS, and instantly access any saved scripts in your
SSC briefcase from the favorites tab.
Download now (direct download link)
Thank this author by sharing:
By Max Yasnytsky,
Sometimes it is required to track growth of the data in the database. Google returned several ways of doing it but they all use msdb.dbo.backupset table. This approach is very good for historical analysis but may not work if you need to check the data growth daily over a short period. msdb.dbo.backupset records the size of the data file but not the actual size of data inside. Hence, even though the data is growing, size of the data file will be shown same until it will be full and grow again.
First script shows actual size of the data in the database, as well as size of allocated storage space. By default, script ignores other file types then ROWS; this can be changed by commenting out line 16.
Second script gives additional breakdown by filegroups.
Note to editor:
This is second time I am posting script on your website and second time having the same issue. There is a problem running scripts after copying them from the web page because of the weird Unicode characters added instead of spaces. It is not visible until script is saved as ANSI text. I order to execute the script I need to save it as ANSI txt first, and then replace "?" symbols and only then script is "understood" correctly by SSMS. Can this be looked into please?
Thanks in advance.
This script converts a number of seconds (integer) to a time string, format 'hh:mm:ss'
In this article Tom Thomson takes a look at what second normal form means, how it is violated, and h...
bulk insert ignores every second linebreak
Select second highest wage