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