EXEC sp_attach_db @dbname = '你的数据库名',
@filename1 = 'mdf文件路径(包缀名)',
@filename2 = 'Ldf文件路径(包缀名)'
转:https://www.cnblogs.com/lj821022/p/4533835.html