• gmac 41947 (2/21/2013)


    If I insert variable in SQL JOB Step, the JOB exec stopped with error.

    When I insert throughout code (variables, bcp command...) in .bat file, and I reference this file in SQL JOB, the JOB was successfully executed.

    This is very interesting! Why get error, if code in JOB step, and why not if code insert in .bat file?

    Those variables and string manipulation functions are native to the DOS command shell only. So you have to be running from a .bat file to use them.

    Now that you have told me this was a SQLAgent job step, you could have generated file name with the current date in it using SQL, then passed the file name as a parameter to the .bat file.

    Anyway, glad you got it working.

    The probability of survival is inversely proportional to the angle of arrival.