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

trying to bcp out a file over the network, can get it to work locally
path i am using is

EXEC master..xp_cmdshell 'bcp "select * from mydatabase.dbo.myview" queryout "\\SERVER2\IT\DIRECTORY\sample.xls" -c -t\t -T -SSERVER1'

getting this error

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

permissions on the destination server are open to everyone, folder is shared.


I have tried running this query using a domain account we have setup for both network and sql.
still getting the same error

Amanda WalshawBusiness Solutions AnalsystAsked:
Who is Participating?
 
geek_vjCommented:
This issue happens due to one of the below reasons:

1) The path/filename is incorrect (check your typing / spelling)

2) The file does not exist. (make sure the file is where you expect it to be)

3) The file is already open by some other app. (close the other app to release the file)

Ensure that you map the destination drive and provide full priveleges to your sql server account.

Please revert in case of any queries.
0
 
Amanda WalshawBusiness Solutions AnalsystAuthor Commented:
found that it was prvileges, sql has issues outputting to a hidden share, once created a new directory all okay
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.