Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 BCP Error

Author  Topic 

carumuga
Posting Yak Master

174 Posts

Posted - 2010-05-20 : 02:02:02
On running the below query using windows authentication which has sysadmin privileges, I'm getting the following error, meaning not able to write to the text file.

EXEC master..xp_cmdshell 'BCP "SELECT top 5 * FROM dbname.DBO.test" queryout "\\sharename\test\Output.txt" -c -T -x'

SQLState = HY000, NativeError = 0
Error = [Microsoft][SQL Native Client]Unable to open BCP host data-file
NULL

carumuga
Posting Yak Master

174 Posts

Posted - 2010-05-20 : 02:03:03
Please help out as we need to fix it in the priority issue. Thanks.
Go to Top of Page

carumuga
Posting Yak Master

174 Posts

Posted - 2010-05-21 : 06:06:21
I know this is the issue with the share drive but what need to be done in order to overcome this issue. I'm running in SSMS... Thanks.
Go to Top of Page

carumuga
Posting Yak Master

174 Posts

Posted - 2010-05-25 : 04:06:21
Issue resolved. Given appropriate privileges to the share drive for the domain account in which the sql agent service account is running.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-05-25 : 04:51:58
Thank you for coming back and posting the solution to your problem.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-05-25 : 05:06:24
quote:
Originally posted by carumuga

Issue resolved. Given appropriate privileges to the share drive for the domain account in which the sql agent service account is running.


When you have a problem like this, it is always that there is a permission issue

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -