Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Data Import Query Connectivity Issue

Author  Topic 

ziggerpig
Starting Member

1 Post

Posted - 2010-07-14 : 09:21:11
Hi:

Very new to SQL Server -- I am trying to import data into a newly established database using a bcp script that has been provided to me....and am experiencing continual error messages that seem to relate to an inability to connect. Here are the steps I am following:

1) Opening SQL Server Management Studio and connecting successfully to server
2) Navigating to the target database and opening a new query
3) Running the script using xp_cmdshell 'c:/data/importdata.bat' (the path and filename of the import batch file)
4) The query begins to execute, runs for a couple of minutes, then produces the following error messages:

Error = [Microsoft][SQL Server Native Client 10.0]Named Pipes Provider: Could not open a connection to SQL Server [2].
SQLState = 08001, NativeError = 2
Error = [Microsoft][SQL Server Native Client 10.0]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.

5) I have gone through all the steps to enable remote connections and Enable Named Pipes, and have also temporarily disabled my firewall. Still no luck.

6) I have a suspicion that the problem may reside in the syntax I am using to specify my SQL server instance name information in the script, as the error seems to appear when the script gets to the point where the -s parameter is specified (noted in red in the script cut and pasted below)

What haven't I tried? Help would be greatly appreciated.

Thanks.


set dataFolder=.\TX_SOR
set formatFolder=.\SqlBcpFormatFiles

@ECHO OFF
cls

set /p s=KITCHENPC\SQLEXPRESS

echo Importing Data..

bcp TX_SOR.dbo.TableFields in %dataFolder%\TableFields.txt -f %formatFolder%\SqlBcpFormatFiles\TableFields.xml -S%s% -U%u% -P%p%
bcp TX_SOR.dbo.INDV in %dataFolder%\INDV.txt -f %formatFolder%\SqlBcpFormatFiles\INDV.xml -S%s% -U%u% -P%p%

echo Done!
pause >nul


(NOTE - THERE ARE SEVERAL ADDITIONAL BCP COMMANDS FOLLOWING THE ONE SHOWN HERE)
   

- Advertisement -