I am using xp_cmdshell to create a trigger file in a perticular location in my stored procedure. I am calling this procedure from windows batch file. I am using %errorlevel% in batch file to check whether the file created successfully or not(to check whether the stored proc executed succesfully or not)..
If that location doesn't exist its not catcuring that error into %errorlevel% , even though the file not created it saying the stored proc exceuted successfully...
without trying understand what your overall objective is - how about check for the existence of the folder before you attempt create a file there? Or check the that the file exists after its attempted creation?
Yes, We can check for the existense of the folder in the stored procedure, If it exists then it should create the trigger file, if not it prints the error message..I am calling the procedure from windows batch script as follws