June 26, 2017 at 6:14 am
I have changed the service account to a domain account that has privileges to the network location. If I log on to SSMS as sa and run the stored procedure it works fine. If I try to run it in an agent it fails with Access denied error code 5.
Been racking my brain to figure this out.
June 26, 2017 at 6:33 am
Bulk Insert uses the privs on the remote system as whomever or whatever is running it. You need for the SQL Agent service login to be able to see the remote folder.
--Jeff Moden
Change is inevitable... Change for the better is not.
June 26, 2017 at 6:37 am
Duh, I didn't even think of that. So I need to change the SQL Agent Service logon also to the Domain logon. Wow, I feel so stupid.
June 26, 2017 at 11:02 am
bswhipp - Monday, June 26, 2017 6:37 AMDuh, I didn't even think of that. So I need to change the SQL Agent Service logon also to the Domain logon. Wow, I feel so stupid.
Actually and quite ironically, you can reduce the footprint by using xp_CmdShell to call BCP or call SQLCmd to call Bulk Insert so that the agent doesn't need such high privs. Used properly, either method has some serious benefits and, used properly, xp_CmdShell does NOT increase any security risks.
If you need more details on any of that, let me know.
--Jeff Moden
Change is inevitable... Change for the better is not.
June 26, 2017 at 11:06 am
That sounds like an article in the making...
How people do it wrong.... and then how to fix it/do it correctly.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply