There are almost certianly better scripts on the Net, but (with a bit of luck) this one will get the correct names for the Logical Log files etc. and create something that you can then run to shrink all (or selectively, some) databasesSET 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 -- Enable this line if you only want logs "bigger" than a specific sizeORDER 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_DatabaseKristen