How-to-simply...

Attach database from YourDbName.mdf without ldf file on SQL Server

  • 1 USE Master
    GO
    CREATE DATABASE [YourDbName]
    ON (filename='c:\MSSQL\Data\YourDbName.mdf')
    FOR ATTACH_REBUILD_LOG
    GO
  • N Migratated from SQL Server 2012 Express to 2016 Express. It runs multiple upgrade steps and creates new LDF log file.

References