Click here to Skip to main content
15,890,506 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
*i installed visual studio 2013 ultimate which includes sql 2012 express edition
* i made a database using the managemnt studio inside the visual studio
* now my problem is that i want to use bcp to back up one of database tables
*i googled through the internet and wrote my query as it stated but every time i get an error
* the query is
declare @sql varchar(8000)
select @sql = 'cd E:\>bcp pharmy_database2012.items out E:\bcptest3.txt -T -S (localDB)\V11.0'
exec master..xp_cmdshell @sql

** ERROR IS
C++
output
Access is denied.
NULL




**SOME ADDITIONAL INFORMATIONS
*SERVICENAME------LOCALDB#F469D3DB
*SERVERNAME -----DESKTOP-2SORBMA\LOCALDB#F469D3DB
*the drive e security permissions is under full controll


what i want is to export datatble of very large size ----can u help me please

What I have tried:

http://www.sqlservercentral.com/Forums/Topic237238-8-1.aspx
http://dba.stackexchange.com/questions/31202/unable-to-open-bcp-host-data-file-error
http://softescu.com/blog/knowledge-centre/error-microsoftsql-server-native-client-100unable-open-bcp-host-data-file-sql
Posted
Updated 24-Mar-16 9:34am

1 solution

Did you try reading the documentation on xp_cmdshell? You better read it, here[^].

Pay close attention to the Remarks and Permissions sections. They'll tell you why you're getting "Access denied".
 
Share this answer
 
Comments
TELFAST180 24-Mar-16 15:51pm    
yes i have enabled xp_cmdshell
Dave Kreskowiak 24-Mar-16 15:55pm    
OK, why? It's a MASSIVE security risk and no DBA is going to enable it for you. Why are you even using it?

You can run the exact same command line, "cd E:\>bcp pharmy_database2012.items out E:\bcptest3.txt -T -S (localDB)\V11.0", by using the Process class.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900