One of my clients is beginning to migrate to SQL 2008 for their SharePoint farms. In the past, we have used scripts to truncate the transaction logs and shrink the DBs in the non-production environments using the “BACKUP LOG [dbname] WITH TRUNCATE_ONLY” command. As you may be aware, the “WITH TRUNCATE_ONLY” option has been deprecated in SQL 2008. In SQL 2008 instead you need to change the recovery mode of the database to SIMPLE and then back to FULL in order to truncate the log (or perform a backup of the log of course). In production environments obviously backing up the transaction log often is the best strategy, however in non-production environments that isn’t always feasible. I wrote the following script for this client to truncate the log all databases other than the system ones.