Hi Guys
Quick script to loop round all databases and perform an action - in this case its setting all databases to simple recovery. The keyword here is sp_msforeachdb - pure genius :)
use master
GO
sp_msforeachdb '
declare @sql VARCHAR(1000)
IF DATABASEPROPERTYEX(''?'', ''Rjavascript:void(0)ecovery'') <> ''SIMPLE''
begin
set @sql = ''ALTER DATABASE ? SET RECOVERY SIMPLE''
PRINT @sql
end'
Wednesday, 1 April 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment