--- (please follow posting protocol) ---
The problem is that your batch file is a single process, and can have
only one ERRORLEVEL.
Here's a way of doing what you want. As ever, each line is indented two
spaces; lines not beginning with two spaces have been wrapped and will
need to be rejoined.
@Echo off
setlocal
set fpath='"C:\106x\
set record="%temp%"\done.
DEL %record%* 2>NUL >nul
SET processes=a b c
set proccnt=0
for %%i in (%processes%) do call :construct %%i %1
:loop
Ping -n 5 127.0.0.1 >nul
set done=0
for %%i in (%processes%) do if exist %record%%%i set /a done+=1
if not %done%==%proccnt% goto loop
(SET done=)
CALL :check %processes%
DEL %record%* 2>NUL >nul
IF DEFINED done goto errblock
GOTO :eof
:check
IF "%1"=="" GOTO :EOF
FOR /f %%i in ( ' type %record%%1 ' ) DO IF NOT %%i==0 SET done=%done% %1
SHIFT
GOTO :check
:errblock
ECHO errors IN process(es) %done%
GOTO :eof
:construct
set /a proccnt+=1
>%record%%1.bat ECHO @ECHO OFF
>>%record%%1.bat ECHO DIR %1*
>>%record%%1.bat ECHO ECHO %%errorlevel%% ^>%record%%1
>>%record%%1.bat ECHO cls^&exit
START /min "running %1" %record%%1.bat
GOTO :eof
Essentially, this creates subsidiary batchfiles in %TEMP% and runs them.
Each subsidiary batch creates a single-line result file containing its
exit errorlevel, also in %TEMP%
I simply executed a DIR command ( :construct +2) - obviously, this would
need to be your SQL. C:\106x is where I develop batch files.
The PING command in :loop is effectively a SLEEP for 5 seconds or so to
stop the process from wasting resources. When all processes have created
their results files, CHECK looks for a non-0 result and accumulates any
non-0-result process names in %done%
Since DIR will always put 0 into the result file, I fudged an error by
simply inserting "1" before %%errorlevel%%
%1 from the main batch is passed to :construct as %2 - I just didn't use
it...