• chumphrey 12211 (8/22/2011)


    I am upgrading and migrating from SQL Server 2000 to 2008 on a new server. I created a new named instance on the new server. I think the 2000 version was a default instance? While testing the migrated Stored Procedures on the new server the following bcp command produced the following error.

    EXEC master..xp_cmdshell 'bcp "select string_out from EmployeeDB..vEmployee_Info order by ssn" queryout "C:\Employee_Info.txt" -c -T'

    SQLState = 08001, NativeError = 2

    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.

    SQLState = S1T00, NativeError = 0

    Error = [Microsoft][SQL Server Native Client 10.0]Login timeout expired

    NULL

    To fix the command ALL I did was add -S server_name\instance after the -T option.

    My question is: Is there a way to resolve this so that the bcp command doesnt have to be modified to work on the new server?

    From the bcp docs: http://technet.microsoft.com/en-us/library/ms162802.aspx:

    -S server_name[ \instance_name]

    Specifies the instance of SQL Server to which to connect. If no server is specified, the bcp utility connects to the default instance of SQL Server on the local computer. This option is required when a bcp command is run from a remote computer on the network or a local named instance. To connect to the default instance of SQL Server on a server, specify only server_name. To connect to a named instance of SQL Server, specify server_name\instance_name.

    When you shut down your 2000 instance if you modify the 2008 instance to answer on port 1433 instead of what it is answering on bcp may start working again without providing the -S option.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato