February 11, 2016 at 2:45 pm
Hi,
I have a stored procedure that reads a flat file from a shared folder. It uses bulk load to read this file and put the contents in a table in my database. I want this stored procedure to run once a day, so I set up a job for it. However, the job is failing and giving me the following warning:
Executed as user: [User]. You do not have permission to use the bulk load statement. [SQLSTATE 42000] (Error 4834). The step failed.
I did give the user bulk admin rights, so I'm not sure why it won't let me do this.
Here is the config for the job step
Thanks
February 11, 2016 at 10:21 pm
There are couple of options you can try. Please check this out:
-Regards
February 12, 2016 at 8:19 am
Have you tried removing the "Run As" user?
--Jeff Moden
Change is inevitable... Change for the better is not.
February 12, 2016 at 11:14 am
If I remove the "Run As" then the NT SERIVCE\SQLSERVERAGENT cannot find the file that I'm trying to bulk load. My initial assumption was because the folder is on a network drive and it most likely didn't have permissions to access it.
I tried running it as a sqlcmd as you can see below:
If I view the job history, it says the following:
Executed as user: [User I'm logged in as]. Msg 4861, Level 16, State 1, Server [localhost], Procedure sp_SYS_import_raw_csv, Line 78 Cannot bulk load because the file "Z:\Schedule\iefin.txt" could not be opened. Operating system error code 3(The system cannot find the path specified.). Process Exit Code 0. The step succeeded.
The iefin.txt is on a network drive, but it is using the correct user. I can open that file if I open a windows cmd. I can also navigate to it. The stored procedure also works fine if I just run it manually.
If i'm able to manually see/open the file and run the stored procedure, then I'm led to believe that there is some sort of security issue. However, I'm not sure why. It is executing as my user account.
Thanks
February 12, 2016 at 11:45 am
Have you tried YourMachineName\InstanceName on sqlcmd command on job step?
-Regards
February 12, 2016 at 12:05 pm
I found the issue. I was trying to use the Z drive when I needed to specify the full path in the stored procedure.
Thanks for the help
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply