SQL Server Uruchom procedurę we wszystkich bazach danych

DECLARE @command varchar(1000)
SELECT @command = 'IF ''?'' NOT IN(''master'', ''model'', ''msdb'', ''tempdb'') BEGIN USE ? print DB_NAME() END' 
EXEC sp_MSforeachdb @command
MzanziLegend