SQL Server 2008 Express Edition: DB Location

Let’s say you used Microsoft Web Platform Installer to install SQL Server 2008 Express Edition you aren’t presented with an option to set your database location. While this is not a problem if you use filebased DBs in your project, this can be a problem when you create the DBs in SQL Server Management Studio.

You can move the database folder to another folder/partition/…

To do this open SQL Server Management Studio. Connect to your instance:

image

And then do a right mouse click on your SQL Server instance and click properties.

image

This will open the following window: Click Database Settings on the left.

image

You can see (on the lower end of the pictures) the ‘Database default locations’. Change these to whatever you want. Be sure to change the log’s location too, you never now when they might come in handy.

While this doesn’t preserve your permissions (if you reinstall the instance,and attach the DBs yourself you will have to take ownership!), this will preserve your data!

Good luck.