Установить модель восстановления SIMPLE для всех баз MS SQL

DECLARE @SqlText VARCHAR(max)  = ''

SELECT @SqlText += 'alter database ['+name+'] set recovery simple' + ';' + CHAR(10) + CHAR(13)
from master.sys.databases
where database_id > 4 and state_desc = 'online' AND recovery_model_desc <> 'SIMPLE'

PRINT @SqlText
EXEC (@SqlText)

+ There are no comments

Add yours