In versions of SQL Server prior to 2005 finding the directory where SQL Server creates its databases was pretty easy since there was a registry key named after the instance of SQL Server and a value that specified the path.
With SQL Server 2005 Microsoft changed everything, making it a challenge to retrieve the correct data directory from a build script. The solution we had in our build script turned out to be wrong, so this afternoon I discovered the correct way to do it. (more…)