You have to write like below.
Below method requires both an mdf file and an ldf file. Otherwise you get an error message: The system cannot find the file specified.
CREATE DATABASE [AdventureWorksDW2012]
ON(FILENAME = N'D:\Databases\AdventureWorksDW2012_Data.mdf')
FOR ATTACH
Now, there is a way to proceed even if you only have the mdf file. Assuming that you have an mdf file that was properly detached from SQL Server, you should be able to attach the mdf file without a log file using the following syntax
CREATE DATABASE [AdventureWorksDW2012]
ON(FILENAME = N'D:\Databases\AdventureWorksDW2012_Data.mdf')
FOR ATTACH_REBUILD_LOG