<div class=”codetitle”><a style=”CURSOR: pointer” data=”42994″ class=”copybut” id=”copybut42994″ onclick=”doCopy(‘code42994’)”> 代码如下:<div class=”codebody” id=”code42994″>
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