附加: USE [master]
GO
CREATE DATABASE [database_name] ON
( FILENAME = N'C:\Data\<database name>.mdf' ),
( FILENAME = N'D:\Data\<database name>.ldf' )
FOR ATTACH ;
GO 转移:
USE master;
ALTER DATABASE foo
MODIFY FILE (name='DB_Data1',filename='X:\NewDBFile\DB_Data1.mdf'); --Filename is new location
ALTER DATABASE foo SET OFFLINE WITH ROLLBACK IMMEDIATE;