附加数据库只有mdf文件无日志文件

--只有mdf文件,没有ldf文件,可通过选项来恢复。FOR ATTACH_REBUILD_LOG;
--有日志文件则附加上,若无,则新建
CREATE DATABASE AdventureWorks2012
ON (FILENAME = 'M:\Program Files\Microsoft SQL Server201201\MSSQL11.MSSQLSERVER\MSSQL\DATA\AdventureWorks2012_Data.mdf')
FOR ATTACH_REBUILD_LOG;