I use this to get rid of unwanted LDF wasted space on DEV boxes (Sorry about the CURSOR chaps!)Kristen-- Script to build a script sutiable for truncated logs on all database-- NOTE: Default state is to just "EXEC" the truncate command-- Make sure "Results in Text" is set in QA - [Use Control-T]-- Script-mode shows the size of LOGs for each DB; -- you can truncate the lot, or use the Size as an indication of which ones -- would benefit from truncatedSET NOCOUNT ONDECLARE @strDatabase sysname, @strSQL varchar(8000)DECLARE CUR_Database CURSOR FOR SELECT [name] FROM master.dbo.sysdatabases WHERE DATABASEPROPERTYEX(name, 'Status') <> 'OFFLINE' AND DATABASEPROPERTYEX(name, 'Updateability') = 'READ_WRITE' ORDER BY 1OPEN CUR_DatabaseFETCH NEXT FROM CUR_Database into @strDatabaseWHILE @@FETCH_STATUS = 0BEGIN -- Build a SQL script to truncate this database. -- NOTE: "GO" cannot appear at the beginning of a line, so {GO} is substituted later -- NOTE: The blank lines separate each "job" a little SELECT @strSQL = 'USE {DATABASE}--{GO}SELECT [--] = ''--'', size, [{DATABASE}] = name FROM dbo.sysfilesWHERE convert(varchar(255), [name]) LIKE ''%\_log'' ESCAPE ''\'' -- AND size > 256ORDER BY 1SELECT TOP 100 ''USE {DATABASE}{GO}BACKUP LOG {DATABASE} WITH TRUNCATE_ONLY{GO}DBCC SHRINKFILE ('' + rtrim(name) +'', 1){GO}''FROM dbo.sysfiles WHERE RTrim(name) LIKE ''%\_log'' ESCAPE ''\'' -- AND size > 256 -- Use this to only target "big ones"ORDER BY 1' SELECT @strSQL = REPLACE(REPLACE(@strSQL, '{DATABASE}', @strDatabase), '{GO}', 'GO')-- SELECT [--SQL] = @strSQL -- For debugging EXEC (@strSQL) FETCH NEXT FROM CUR_Database into @strDatabaseENDCLOSE CUR_DatabaseDEALLOCATE CUR_Database