Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Logical Name




C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA

C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA




What would be the sql script to move these files to a new location: D:\DATA

Database is live so I would need to close existing connections.

share|improve this question
up vote 3 down vote accepted

While you could do this with a SQL Script, this is one of those cases where it's easier to use the management console.

Start the SQL Server 2008 Management Studio and connect to your server as a user with the sysadmin server role. Navigate to your database, right-click and select Tasks -> Detach..., click OK. Now you can move your database files to their new location. Finally, right-click the Databases folder and select Attach..., select the appropriate files and click OK. Your database will now be online using the files in their new location.

share|improve this answer
easy! thanks for the help! – FiveTools Jul 5 '11 at 19:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.