I am trying to script a DOS batch file (for NT/2000) which will run some SQL via ISQL and have a return code passed back to the operating system so that I can check the %ERRORLEVEL% value.

I understand that isql (or osql) with MS SQL Server allows you to exit and return any value back to the OS as the return code via the EXIT() function... for example:

dbcc checkdb (dbname)
EXIT(select @@error)


declare @value int
select @value = 5
EXIT(select @value)

Is there something similar that can be done in ISQL for Sybase to pass a result or a return code back to the operating system?

Thanks & regards,