Extract data from table to a remote path using BCP

  • How to extract data from table to a remote(shared) path rather than to the database server path?

    I tried with the following command :

    bcp "select * from tblemp" queryout "\\server\folder\test.txt" -c -t , -S "DBserver -o "1.TXT" -U "Sa" -P "password"

    and get the error msg as

    bcp: Unable to open output file \\server\folder\test.txt: Permission denied.

     

    can anyone help me out on this?

  • Sounds like a permissions issue with the directory or the share.

     

  • The SQL Server "Service" must be logged in as a user that can "see" those remote paths.  As Lynn said, that also means that user must have permissions to see those remote paths.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • I had tried providing "Everyone" access rights to the share. But doesn't resolve

  • Check the sql server service.

    If it's using local system account, it won't work.

    You need to start the service using a 'normal' windows account.

    Then grant this account permissions on the remote share, and try again.

    /Kenneth

  • sqlserver service was running in windows account only and access rights had been provided to the share for this account.Actually in BCP i am connecting to the SQLSERVER through an account that is different from the SQLserver service account. Does this matters? Also the account i was using for BCP has access to the share

  • People talking not about acounts conecting to SQL Server, but about the account started SQL Server

    _____________
    Code for TallyGenerator

Viewing 7 posts - 1 through 6 (of 6 total)

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