Need login help to send files to

  • Are you asking how to connect to the remote server? Use Windows authentication, assuming SQL Server runs under a domain account in the same domain as the remote server (or a trusted domain). But why are you using sqlcmd to connect to the local instance? Why not just run the query direct in the stored procedure?

    John

  • I believe so. What I need is for the script to have the username and password in it so that when the files are transferred to that server, it wont prompt for log-in information.

  • John,

    Maybe I am doing something wrong with it. I need to copy the files that each section outputs to a server which has a log on and I am not sure how to save the logon user name and password in the script. Hopefully this helps a little more.

  • jonathanm 4432 (7/20/2015)


    John,

    Maybe I am doing something wrong with it. I need to copy the files that each section outputs to a server which has a log on and I am not sure how to save the logon user name and password in the script. Hopefully this helps a little more.

    Is that server in the same domain as the one that you're issuing the BCP commands from???

    --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)

  • No, has to go to an ip address and need to use a user name and password.

  • If it's in a seperate domain, it may be easier using SSIS to do it, or output the file locally and use xp_ cmdshell to run a batch command to do the login and transfer the file (although this would not be my prefered option).

    Although, another option could be to set up a Windows Task to run a sqlcmd query to output the file, log in and transfer. That way you don't need to enable xp_ cmdshell.

    I'm a DBA.
    I'm not paid to solve problems. I'm paid to prevent them.

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

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