Issue with BCP

  • I am having a couple of issues with BCP (one from a PROC, and another from the command line). I'll stick with the command line issue for now, in hopes that it might be similar to the other error I am getting with the proc...

    Here is my command line statement...

    bcp [FLEET-V3].dbo.BW_AWARE_DEVICE in \\PRO-DBSERVER4B\D$\Staging\V3_2\Maintenance\TableDiff\BCP\BW_AWARE_DEVICE.bcp -T -N

    When I run this, it errors out saying it cannot log onto the server (even thought I have the -T for trusted connection specified.

    The problem I am having with the PROC is completely different, but I think maybe related...It states that it cannot open the host BCP data file, but I know this is not a permissions issue (because I have tried multiple drives and have created files, modified content in those files, and saved them without issue).

    Any assistance on this would be appreciated.

    Thank you!

  • I do not see a -S. Are you trying to connect to the default instance on the machine where you're running bcp?

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

  • Hello -

    Yes - both databases are in default instances. My understanding of the -S switch is that it gives you the ability to specify the server name if it is in a named instance. Does this need to be in there anyway, regardless?

    Here is the error

    C:\>bcp [FLEET-V3].dbo.BW_AWARE_DEVICE in \\PRO-DBSERVER4B\D$\Staging\V3_2\Maint

    enance\TableDiff\BCP\BW_AWARE_DEVICE.bcp -T -N

    SQLState = 37000, NativeError = 4060

    Error = [Microsoft][SQL Native Client][SQL Server]Cannot open database "FLEET-V3

    " requested by the login. The login failed.

    SQLState = 28000, NativeError = 18456

    Error = [Microsoft][SQL Native Client][SQL Server]Login failed for user 'PRO-DBS

    ERVER4B\sqladmin'.

  • Also - the databases are on 2 different servers in the same subnet (I can load both instances on either machine when I remote in).

    The error starts off by saying that the login failed for FLEET-V3 (which is the PROD database), but then ends by saying that the login failed for the user on the other server as well (PRO-DBSERVER4B) which is where the TEST database is at that I am trying to get the data put together for.

    Double whamy? Or normal login error? The user is a Windows based user who an access either instance directly without issue from SSMS using Windows Authentication.

  • Rich Yarger (5/3/2012)


    Hello -

    Yes - both databases are in default instances. My understanding of the -S switch is that it gives you the ability to specify the server name if it is in a named instance. Does this need to be in there anyway, regardless?

    It will try the default instance if -S is not provided on the cmd line...and it sounds like that is what you want, so no, -S would not be required for you.

    Here is the error

    C:\>bcp [FLEET-V3].dbo.BW_AWARE_DEVICE in \\PRO-DBSERVER4B\D$\Staging\V3_2\Maintenance\TableDiff\BCP\BW_AWARE_DEVICE.bcp -T -N

    SQLState = 37000, NativeError = 4060

    Error = [Microsoft][SQL Native Client][SQL Server]Cannot open database "FLEET-V3" requested by the login. The login failed.

    SQLState = 28000, NativeError = 18456

    Error = [Microsoft][SQL Native Client][SQL Server]Login failed for user 'PRO-DBSERVER4B\sqladmin'.

    Simple as PRO-DBSERVER4B\sqladmin not having access to DB [FLEET-V3]?

    BTW I was curious about bcp handling a dash in the DB name, but I tested it and it looks to be fine with it.

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

  • opc.three (5/3/2012)


    [Simple as PRO-DBSERVER4B\sqladmin not having access to DB [FLEET-V3]?

    The user sqladmin is a Windows user - not a SQL user, but has all needed privileges to operate in the envionrment(s).

  • Rich Yarger (5/3/2012)


    opc.three (5/3/2012)


    [Simple as PRO-DBSERVER4B\sqladmin not having access to DB [FLEET-V3]?

    The user sqladmin is a Windows user - not a SQL user, but has all needed privileges to operate in the envionrment(s).

    Got that part...

    I gather that you have two bcp CDMA in sequence, one getting data out of serverA and the second putting that data into serverB. Correct?

    It may be a good idea to provide -S on both calls to bcp just to be sure you're hitting the correct server during both calls.

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

  • Actually, I was only trying to export to a text file to start, and was going to use the BULK INSERT command from SSMS, but it's okay - we have it fixed now. Thank you for all of your assistance.

  • Sure, happy to assist 🙂 what was the issue?

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

  • Honestly? I don't really know. The import was delegated to someone else who was whining about me taking to long to figure it out, so what they did to get the data in - I have no idea.

    :ermm:

  • Bummer, sorry to hear that. If you find out please post back...hopefully someone else will benefit down the line.

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

Viewing 11 posts - 1 through 10 (of 10 total)

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