For background, we ave two servers (DEV and PROD) and they are set up slightly differently.
On DEV, the mdf files are stored on the E: drive, on PROD the mdf files are stored on the D: drive.
What I'd like to do is change the drive on the DEV server to be D: to match the PROD server (we have some code that references the drives by letter that I have to remember to change when I push the code from DEV to PROD.
I can easily move the user database files from one drive to another (I've got code for that).
I'd like to move the system databases as well but I don't want to crash everything.
Is the routine the same for moving the mdf's for the system databases the same as for user databases?
I've attached my code for moving the user databases for reference. It generates a script (with comments) that you run through in sections as you move the files around (any improvements on this would be appreciated) as we occassionally get databases created on the wrong drive.