When I run batch file with:
BCP "SELECT * FROM [KW_GRECOS].[dbo].[V_G076a]" queryout "G:\Bulk\V_G076a_new.bcp" -N -S localhost -T -E
BCP "[KW_GRECOS].[dbo].[hist_V_G076a]" IN "G:\Bulk\V_G076a_new.bcp" -N -S localhost -T -E -b 1000000 -h "CHECK_CONSTRAINTS"
It works perfectly, but when I execute same batch from job in SQL Server Agent:
cmd.exe /c "E:\batch\Bulk_copy.bat"
It's not working:
Date,Source,Severity,Step ID,Server,Job Name,Step Name,Notifications,Message,Duration,Sql Severity,Sql Message ID,Operator Emailed,Operator Net sent,Operator Paged,Retries Attempted 12/21/2017 00:40:37,NightBulk,Error,,DBSERVER,NightBulk,,,The job failed. The Job was invoked by User eTour\ITcom. The last step to run was step 1 (1 Bulk insert). The job was requested to start at step 1 (1 Bulk insert).,00:00:00,0,0,,,,0 12/21/2017 00:40:37,NightBulk,Error,1,DBSERVER,NightBulk,1 Bulk insert,,Executed as user: DBSERVER\ITcom. C:\Windows\system32>BCP "SELECT * FROM [KW_eTour].[dbo].[V_G075a]" queryout "G:\Bulk\V_G075a_new.bcp" -N -S localhost -T -E SQLState = S1000 NativeError = 0 Error = [Microsoft][ODBC Driver 11 for SQL Server]Unable to open BCP host data-file. Process Exit Code 1. The step failed.,00:00:00,0,0,,,,0