Connecting to SQL Server 2005 from CMD window

  • I am trying to use the bcp.exe program in a CMD window to create a bulk insert format file.  No matter what I do, I cannot get a connection to the database. 

    The server is a named instance.  Not sure if there is special command-line syntax to deal with that.

    Everything is on the same box, so there are no firewall or UNC naming issues.

    The command I am using is:

    "bcp.exe databasename.tblname format nul -c -t , -f c:\formatfile.fmt -T".

    For what it's worth, I have set "Allow Remote Connections" to true and restarted the database engine.

    I get the errors:

    SQLState = 08001, NativeError = 2

    Named Pipes Provider: Could not open a connection to SQL Server [2]

    Login Timeout Expired

    An error has occurred while establishing a connection to the server.

    Any help would be appreciated.

    Thanks,

    Ken Wells.

  • I solved all the issues with this post.

    The named instance was key to the issue.  There is a special flag and parameter needed to successfully connect to a named instance via the command window.

    The format 'database.table' for the source object parameter (taken from SQL Server Help) is incorrect.  After trying many different formats for this parameter, I discovered it.  I have not seen the specific problem documented anywhere.

  • Then why not post your solution for other folks' benefit ?

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply