I have a sqlcmd script, it runs fine if I open the command line to run it.
sqlcmd -S (local) -d mydb -E -s, -W -i D:\_ssisfiles\scripts\ProductMap.sql | findstr /V /C:"-" /B > D:\_SSISFiles\Scripts\xtest.csv
But if I makes it to a sql agent job, the job failed and it got the following error:
Sqlcmd: Error: Error occurred while opening or operating on file | (Reason: The filename, directory name, or volume label syntax is incorrect). Process Exit Code 1. The step failed.
Anything I am missing?
The sql agent service account has full control of the file directory.