Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Shrink logs
Message
From
10/07/2009 16:17:39
 
 
To
10/07/2009 15:50:08
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01411487
Message ID:
01411503
Views:
44
The same way :-):
sp_MSForEachDb 'declare @LogFile nvarchar(2000)
                declare @ExeString nvarchar(2000)
                IF ''?'' NOT IN (''master'', ''tempdb'', ''model'', ''msdb'')
                   BEGIN
                      USE [?]
                      SELECT @LogFile = dbo.sysaltfiles.name
                             FROM master.dbo.sysdatabases
                      INNER JOIN dbo.sysaltfiles ON master.dbo.sysdatabases.dbid = dbo.sysaltfiles.dbid
                      WHERE (master.dbo.sysaltfiles.fileid = 1) AND (master.dbo.sysdatabases.name = ''?'')
                      ALTER DATABASE [?] SET RECOVERY SIMPLE
                      SET @ExeString = ''DBCC SHRINKFILE ('' + QUOTENAME(@LogFile) + '', 1)''
                      EXEC (@ExeString)
                    END'
Check for errors, because I wrote this directly here and didn't test it :-)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform