Hello,
I'm not very good with scripting loops.
I want to loop through each database and check the LogFile Size and Free Space on Log File.
If it meets these conditions I want to truncate.
If @logsize >= 20000 -- and @logspace >= 80
set @SQL = 'use' + [Database_Name] + 'dbcc shrinkfile ([LogFileName], 20000, TRUNCATEONLY) WITH NO_INFOMSGS'
exec (@SQL)
Please help