ERRORCODE is the database error code from the most recent database request - and since the last database request was a successful LOGON, ERRORCODE is zero.
Perhaps you want to use ERRORLEVEL, which is the highest severity code encountered.
Also note that "MAXERROR = 1" means that the script will automatically exit if ERRORLEVEL > 1 but will continue if ERRORLEVEL <= 1.
↧