I execute in a batch script a SQL file to backup my database. I want from the sql file / script a return code to see if is success or not.
I excuted this
isql -S %DBSID% -D %DBSID% -U %DBUSER% -P%DBPASS% -X -i "C:\example\backup.sql" >> "C:\logs\fullbackup.log"
Anyone can help?
I am not sure if
isql
sets an%errorlevel%
or return code but, if it does you can use something like this:This will simply check for an
%errorlevel%
andif
it's 'not equal too'NEQ
'0' then it will simplyecho
"error occured" otherwise "success".You can experiment with the
if
conditions or if you require more help, you can also refer to the site.