新建一个查询:
输入指令
USE master;
GO ;
CREATE DATABASE @DBNAME
在单引号中写上你的mdf文件和ldf文件路径:
ON (FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\student_data.mdf'),
(FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\student_log.ldf')
FOR ATTACH;
GO