Find DataBase Backup Modes

,

This is just a quick method to determine the backup mode of all databases on a server.  No cursor involed.

use master
go
if exists (select 1 from tempdb.dbo.sysobjects where name like '%dbmode%' and type = 'u')
begin
drop table ##dbmode
end
create table ##dbmode (
DBNamevarchar(60),
Modesql_variant)
setnocount on
exec master.dbo.sp_msforeachdb 
"USE [?]
insert##dbmode
SELECTdb_name(),DATABASEPROPERTYEX('?', 'Recovery')
" 
select * From ##dbmode
order by dbname

Rate

2 (1)

Share

Share

Rate

2 (1)