USE MASTER
GO
EXEC master..sp_MSForeachDB '
USE [?]
IF ''?'' <> ''tempdb'' AND ''?'' <> ''msdb''
BEGIN
DBCC
CHECKDB (''?'')
END'
GO
Scripts, Articles, Relevant for DBAs, Consultants, BI, Data Scientists and Developers
USE MASTER
GO
EXEC master..sp_MSForeachDB '
USE [?]
IF ''?'' <> ''tempdb'' AND ''?'' <> ''msdb''
BEGIN
DBCC
CHECKDB (''?'')
END'
GO