Situatie
Mai jos aveti o procedura care rulata pe un server sql returneaza fiecare baza de date impreuna cu modelul setat de restaurare pentru fiecare baza in parte.
Solutie
alter procedure DatabasesRecoveryModel_prc
as
declare @dblist table(db sysname,model char(45))
declare @dbname sysname,@model char(45)
insert @dblist(db)select name from master..sysdatabases
where name not in (‘master’,’model’,’tempdb’,’msdb’)
select @dbname=min(db) from @dblist
while @dbname is not null
begin
select @model=cast(databasepropertyex(@dbname, ‘Recovery’) as char(45))
update @dblist set model=@model where db=@dbname
select @dbname=min(db) from @dblist where db>@dbname
end
select * from @dblist
order by 1
Leave A Comment?