SQL Server - Move MDF FILE

--STEP 1 use master GO alter database mydb set single_user with rollback immediate GO exec master.dbo.sp_detach_db @dbname= N'mydb' GO --STEP 2 -- TODO on OS : cut and paste files in destination folder --STEP 3 create database mydb ON ( FILENAME = N'E:\mydb\mydb.mdf'), ( FILENAME = N'E:\mydb\mydb.ldf'), ( FILENAME = N'E:\mydb\mydb.ndf'), ( FILENAME = N'E:\mydb\mydb2.ndf') FOR ATTACH GO

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.