I have the following maintenance script
DECLARE @sql NVARCHAR(30) = 'DBCC CHECKDB(?)' EXEC sp_MSforeachdb @sql
This checks every database for corruption. I have run this on my test server where I deliberately corrupted a database and as expected, the
DBCC CHECKDB errors for that database, however, this then ends the script, so all the other databases that haven't yet been checked go unchecked.
Is there a way I can make the script continue on error so that the remaining databases get checked?
I have also tried Aaron Bertrand's sp_foreachdb and found the behaviour to be the same
1: https://www.mssqltips.com/sqlservertip/2201/making-a-more-reliable-and-flexible-spmsforeachdb/ as well as Ola.Hallengren's SQL Server Integrity Check using the command
DatabaseIntegrityCheck @Databases = 'ALL_DATABASES' which again gives the same behaviour
I have noticed management studio shows "Disconnected" at the bottom also