![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Ideas on how to handle this programatically? |
#3
| |||
| |||
|
|
Please always post the version and build number of SQLAnywhere that you are using (e.g. use the command "dbeng9 -v" for SQLAnywhere 9.x). |
|
Can you give us a direct example of what kind of error you are trying to have DBISQL catch? |

#4
| |||
| |||
|
|
Please always post the version and build number of SQLAnywhere that you are using (e.g. use the command "dbeng9 -v" for SQLAnywhere 9.x). My apologies, I'm usually better about that sort of thing. ASA 9.0.2.3207 Can you give us a direct example of what kind of error you are trying to have DBISQL catch? Essentially, if SQLCODE<>0, I want dbisql to return something (preferably an ERRORLEVEL) so my batch file knows that something didn't go right. That way when I run several dbisql calls in a row, the next one won't execute if the first one dies. IE: dbisql -c "params here" -nogui -onerror continue -d1 READ "test.sql" IF NOT %ERRORLEVEL% == 0 GOTO ERROR dbisql -c "params here" -nogui -onerror continue -d1 READ "test2.sql" IF NOT %ERRORLEVEL% == 0 GOTO ERROR ... Etc,etc. Right now, if it can't connect to the DB, or something like that, it will raise an ERRORLEVEL. However, say inside "test.sql" I have something like: SELECT * FROM FOOBAR; But there isn't any table named "FOOBAR" -- it won't set an ERRORLEVEL, but there was still an error. I want it to detect that there WAS an error so I can stop it. ![]() Thanks, Nathan |
#5
| |||
| |||
|
|
Nevermind; I have found the solution myself. The key is to switch the "-onerror continue" to "-onerror exit", thus making dbisql exit with ERRORLEVEL of 5 when an SQL error occurs. |

![]() |
| Thread Tools | |
| Display Modes | |
| |