December 18, 2008 at 12:25 am
I get this error message:
SQLState = HY000, NativeError = 0
Error = [Microsoft][SQL Native Client]Unable to open BCP host data-file
if I try to run
EXEC master..xp_cmdshell
bcp "select top 100 * from test.dbo.Table_1" queryout "c:\data.txt" -c -Usa -Psa123 -SD-D-MIRS\SQLEXPRESS'
from Query Analyzer (or a store procedure).
If run the same command in cmd or run window (without EXEC and xp_cmdshell) I do not get any error and the content of the table is exported in the file I want...
If the exported file is on a local folder on the server everything is working fine even in Query Analyzer...
Thank
Manas
January 31, 2010 at 1:26 pm
Make sure cmdshell is enabled.
The best way is to create a job and make sure the Job is running under the correct user which has the rights to read/write to the folder.
March 10, 2011 at 6:55 am
Hi,
I had the same scenario.
Check the sql server service, it should be running with permissions for the folder that you're extracting to.
I'm using SQL express 2008 R2 with a Local system account.
It didn't work, because it was configured to use a Network Service.
Best regards,
Chen
August 7, 2012 at 4:50 am
I received a similar error message when running a bcp command from SSMS, however it ran ok from a command prompt.
The SQL Service Account didn't have write permissions to the output file location!
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy