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
isqlsets an%errorlevel%or return code but, if it does you can use something like this:This will simply check for an
%errorlevel%andifit's 'not equal too'NEQ'0' then it will simplyecho"error occured" otherwise "success".You can experiment with the
ifconditions or if you require more help, you can also refer to the site.