Commit for development environment setup
This commit is contained in:
8
PROMS/SQL/SearchAllDBs.sql
Normal file
8
PROMS/SQL/SearchAllDBs.sql
Normal file
@@ -0,0 +1,8 @@
|
||||
declare @CommandLine nvarchar(max)
|
||||
SET @CommandLine = 'select ''{Name}'' dbname, type, count(*) HowMany from {Name}.dbo.contents where type in (20008, 20010, 20033, 20034) group by type'
|
||||
declare @CommandLines nvarchar(max)
|
||||
select @CommandLines = Coalesce(@CommandLines + ' UNION' + char(10), '') + Replace(@CommandLine,'{Name}',Name)
|
||||
from Sys.Databases where name like 'VEPROMS%'
|
||||
Set @CommandLines = 'Select * from ( ' +@CommandLines + ') t1 where HowMany > 0'
|
||||
print @CommandLines
|
||||
EXEC SP_EXECUTESQL @CommandLines
|
Reference in New Issue
Block a user