復制代碼 代碼如下:
USE master;
Go
EXEC sp_attach_db @dbname = N'數據庫名',
@filename1 = N'完整目錄的mdf文件',
@filename2 = N'完整目錄的ldf文件';
GO
如
USE master;
Go
EXEC sp_attach_db @dbname = N'db_shop', //db_shop是數據庫名字
@filename1 = N'E:\TM\07\Database\db_shop_Data.MDF',
@filename2 = N'E:\TM\07\Database\db_shop_Log.LDF';
GO