Having an issue with exporting files to a network drive via the BCP host data file.
There is no problem in exporting a file to the C drive of the machine that the
SQL Server is installed on, however when exporting to a network drive (Same domain) I receive the following error:
*SQLState = S1000, NativeError = 0
Error = [Microsoft][ODBC Driver 11 for SQL Server]
Unable to open BCP host data-file NULL*
The test code is
DECLARE @sql VARCHAR(8000); DECLARE @Path varchar(max) SET @Path = '\\network\location\' SELECT @sql = 'bcp "SELECT FROM [Servername].[Schema].[Table]" queryout ' + @Path + '-c -t, -T -S' + @@SERVERNAME; exec master..xp_cmdshell @sql;
I have taken a look at the other examples around this issue, however still no joy. What other area should be considered in rectifying this issue..