Run same command on all SQL Server databases without cursors

Query File Information From All Databases On A SQL Instance 

declare @Temp table(Fileid    varchar(1000),Groupid varchar(100),Size varchar(100),maxsize varchar(100),
Growth varchar(100),Status varchar(100),Perf varchar(100),    Name varchar(100),[Filename] varchar(100))

insert into @Temp
EXEC sp_MSforeachdb 'use ? select * from sysfiles '

select * from @Temp
where Name in('master','mastlog','ReportServer','ReportServer_log','MSDBData','MSDBLog')

0 comments:

Post a Comment

Your Location