Does SSEUtil.exe have a "errorlevel"?

I am going to write a DOS batch file to execute a bunch of SSEUTIL command, such as

sseutil -run aaa.sql -m

sseutil -run bbb.sql -m

....

My question is, can I use the following skills to show error message if the aaa.sql failed to be executed

SSEUTIL-run aaa.sql -m
if errorlevel 1 goto ERROR1

...

Thanks.



Answer this question

Does SSEUtil.exe have a "errorlevel"?

  • raagz

    Thanks Antoine. Very helpful.
  • RisTar

    Hello Tony,

    very good question. Unfortunately, SSEUtil doesn't currently set the error level properly so that won't work as expected.

    You might be able to work around this current limitation it in a few ways:

    (1) You could use the logging feature of SSEUtil (-log option) to have the results of the script written to a log file. Then you could open the log file and make sure that there were no SqlException messages or that a certain message is present.

    (2) You could write a small console app to drive SSEUtil. That console app would start SSEUtil in console mode (-c option), then run the first script file (-run ...) at that point, you could read the output from the stdout and check the results

    In either case, you could use the 'SELECT @@ERROR' which tells SQL Server to give you the error code for the last statement that executed in the session. If it's 0 then it succeeded else it failed.

    Again, this is not a solid solution but it might allow you to get past the current limitation.

    HTH

    Antoine
    Microsoft Visual Studio team.


  • Does SSEUtil.exe have a "errorlevel"?