Move SQL Server 2008 database files to a new folder location

Viewed 122433

Logical Name

  • my_Data
  • my_Log

Path:

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

FileName:

  • my.MDF
  • my_1.LDF

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.

5 Answers
Related