While we want to attach a singal .MDF file(without log file) for a DB in SQL SERVER, we will meet the problem "At least one file is needed for database attach" enven if renamed the MDF to the same name with target DB.

 

we can use the cmd as below:

CREATEDATABASE AdventureWorks2008R2 ON

(FILENAME=N'E:\SQLBI\AdventureWorks2008R2.mdf')

FORATTACH

GO

posted on 2018-05-22 10:07  怡星梦  阅读(220)  评论(0)    收藏  举报