This is a combination of logic from 2 previous posts - this piece of code will truncate the log file size for all the databases in a SQL Server. It has been tested against SQL 2000 and 2005
--delcare variables
declare @vchrTable varchar(200),
@vchrMsg varchar(200)
--declare the cursor
DECLARE curTables CURSOR FOR
SELECT name from master..sysdatabases order by 1
--open the cursor
OPEN curTables
--loop through the cursor lines
FETCH NEXT FROM curTables INTO @vchrTable
WHILE @@FETCH_STATUS = 0
BEGIN
set @vchrMsg = 'DBCC SHRINKDATABASE ( [' + @vchrTable + '] ,10);'
print @vchrMsg
exec (@vchrMsg)
set @vchrMsg = 'backup log [' + @vchrTable + '] with truncate_only;'
print @vchrMsg
exec (@vchrMsg)
--backup log tstoday with truncate_only
FETCH NEXT FROM curTables INTO @vchrTable
END
--clean up
CLOSE curTables
DEALLOCATE curTables