First, backup your databases in case something goes wrong.
Then, use the sp_detach_db and sp_attach_db system procedures to detach and then attach your databases. If users are trying to connect it may help to set single user mode on the databases.
After you detach the database with sp_detach_db you can move the files, then use sp_attach_db to attach them back to the SQL Server.
If you want to move the system databases it is a bit more tricky, involving setting a trace flag, moving the mdf and ldf files, stopping and starting the server, and finally changing the location of the master database. There are some gotchas possible in doing this.
Last Wiki Answer Submitted: July 9, 2009 10:02 pm by Denny Cherry64,505 pts.
All Answer Wiki Contributors: Denny Cherry64,505 pts.
If you live outside the United States, by submitting your email address you consent to having your personal data transferred to and processed in the United States.