SQL query to shrink all log files on sql instance



USE master

exec sp_MSforeachdb '

use [?]
 print ''?''
 print cast(databasepropertyex(''?'', ''Updateability'') as varchar(200))

 if databasepropertyex(''?'', ''Updateability'') = ''READ_WRITE ''

   dbcc shrinkfile(2,1)

'





Comments

Most Popular

DMV To List Foreign Keys With No Index

Generate SQL script to extract user permissions from a SQL database