I want write query to run the BCP utility and save the query result into the network share folder.
For that purpose I mapped another pc's share folder in my local network to my drive. That drive name is z
. In my explorer it shows me the mapped drive. Opening that drive works and I have full control over it, but when I run this query:
EXEC xp_cmdshell 'bcp "SELECT "028",rtrim(ltrim(anumber)),rtrim(ltrim(bnumber)),rtrim(ltrim(duration)) FROM [myTestReport].[dbo].[CDR]" queryout z:\beh.csv -S DESKTOP-A5CFJSH\MSSQLSERVER1 -Umybehzad -Pbeh1368421 -f "f:\myFORMAT.fmt" '
I get this error:
unable to open BCP host data file
How can I solve that problem? Thanks.