1.在数据库中新建查询,NewFile是数据库名称(可更改),.mdf,.ldf放在对应得C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA对应得数据文件下,执行脚本即可
USE master;
GO
CREATE DATABASE NewFile
ON (FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\db_NetShop.mdf'),
(FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\db_NetShop_log.ldf')
FOR ATTACH;
GO