• I work in SQL SSMS 2012. We maintain a primary SQL server 2008 R2 for all the SQL agent jobs.

    Many job steps include CMDEXE calling .BAT files.

    All run as the same Domain Admin account to ensure access to all network locations.

    On occasion, one of these jobs up and fails after having run successfully for months and years.

    I just spent hours messing with this myself because there was no explanation, no change in credentials, no change to our network, etc., and no change to the code or the job steps, etc.

    One of these jobs in particular, the .BAT script is "IF the file exists, do these things, ELSE GOTO END".

    So I decided to handle the ELSE another way instead of simply exiting the program. I changed ELSE to "run this .vbs that emails a failure message" and VOILA, for some reason the SQL job runs perfectly fine now. I changed NOTHING else.

    Does Microsoft no longer like ELSE statements that simply exit a program? What happened to just IF something and nothing else? Not sure why that worked exactly, but really nothing else changed and the SQL Job Agent worked the very next several times I tested it.