Following command will take care of creating the new db using existing single data file. This command will also creates a new log file and you can ignore previous log files if any in case if it has more initial allotted size which you don’t want to give for new db.
CREATE DATABASE <DB Name> ON
(FILENAME = N’C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\SS.mdf’)
FOR ATTACH_REBUILD_LOG
GO
You can also use …
EXEC sp_attach_single_file_db @dbname = ‘SAMS_QA’,
@physname = N’C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\SS.mdf’;
Reference – http://blog.sqlauthority.com/2010/04/26/sql-server-attach-mdf-file-without-ldf-file-in-database/