This script is very helpful for anyone trying to recreate particular SQL Server Database Versions for Testing. It allows you to automatically recompile any stored procedures or views saved with drop, create and permission statements. The scripts must all be sitting in one directory and end in the same extension. I have found this very useful in the development lifecycle or when trying to release code in batches.
This stored procedure detaches and re-attaches a database without specifying a filename for the transaction log. This causes SQL Server to create log file with default size of 512kb.After playing around with SHRINKDATABASE, SHRINKFILE, forcing the virtual log to wrap around, etc... I found this was the quickest and most reliable method of reclaiming the […]