title: How to recover database from MDF in SQL Server 2005?
body: <p>I have an MDF file and no LDF files for a database created in MS SQL Server 2005.    When I try to attach the MDF file to a different SQL Server, I get the following error message.</p>
  
  <p><code>
  The log cannot be rebuilt because there were open transactions/users when the database was shutdown, no checkpoint occurred to the database, or the database was read-only. This error could occur if the transaction log file was manually deleted or lost due to a hardware or environment failure.
  </code></p>
  
  <p>I would like to accomplish any one of the following options:</p>
  
  <ol>
  <li>Attach the database without data loss (unlikely but would save me some time).</li>
  <li>Attach the database with data loss (whatever transactions were open are lost).</li>
  <li>Recover the schema only (no data) from the MDF file.</li>
  </ol>
  
  <p>What SQL commands can I try to get my database going again?</p>