If you have ever come across a problem where the MSSQL host (eg windows) has crashed for some reason or another that you may have also come across the problem of having a possible issue with some of the databases coming corrupt where here is a way to run the dbcc check db command for all databases on an ms SQL instance.
EXEC sp_MSforeachdb @command1 = 'DBCC CHECKDB(?) WITH NO_INFOMSGS; PRINT ''Checked ? Status:'' + CONVERT(VARCHAR(255), @@ERROR)'
Example output is simple. Anything with a status which is no "0" should be investigated.
Checked master Status:0 Checked tempdb Status:0 Checked model Status:0 Checked msdb Status:0 Checked JEPS Status:0 Checked distribution Status:0 Checked Testing Status:0
Did You find this page useful?
Thanks for the feeback. Please consider sharing with others.