title: Truncate Log Files in SQL Server 2008 R2
body: <p>Here is my query in SQL Server 2005 that I use for truncating log files.</p>
  
  <p>My log file will grow to 7G and when I execute this query in a nightly job it will truncate it to 10M. How do I replicate this query in SQL Server 2008 R2? My current query errors with NO_LOG.</p>
  
  <pre><code>Use Master
  
  BACKUP log DBNAME WITH NO_LOG
  
  --Shrinks the size of the Log (.ldf) file
  USE DBNAME
  
  DBCC SHRINKFILE (DBNAME_Log)
  </code></pre>