none
How to call SFTP using ssis script task RRS feed

  • Question

  • Hi Team,

    Have stored sftp data into sql table as shown in bellow.


    AccountNumber SFTPUser SFTPPassword SFTPURL Email IsActive
    ACN1 UserName Password ACN1.com mail@google.com 1
    ACN2 UserName Password ACN2.com mail@google.com 1
    ACN3 UserName Password ACN3.com mail@google.com 1
    ACN4 UserName Password ACN4.com mail@google.com 1
    ACN5 UserName Password ACN5.com mail@google.com 1
    ACN6 UserName Password ACN6.com mail@google.com 1
    ACN7 UserName Password ACN7.com mail@google.com 1
    ACN8 UserName Password ACN8.com mail@google.com 1
    ACN9 UserName Password ACN9.com mail@google.com 1
    ACN10 UserName Password ACN10.com mail@google.com 1

    How to call the these many sftp server one by one using script task. Please help on this issue.


    Thanks Bala Narasimha

    Previously am using bellow script for calling sftp server

    //scriptContent.AppendLine("# Connect to SFTP server using a password");
                scriptContent.AppendLine(string.Format("open sftp://UserName:Password@sftp.acn1.com/"));
                scriptContent.AppendLine(string.Empty);

                //scriptContent.AppendLine("# Upload file");
                scriptContent.AppendLine(string.Format("put {0}", "F:\\NewFolder\\@AccountNumber_" + theDate.ToString("yyyyMMdd") + ".csv"));
                scriptContent.AppendLine(string.Empty);

                scriptContent.AppendLine("# Disconnect");
                scriptContent.AppendLine("close");

    But now have more than 20 sftp server to fetching data.

    • Edited by BaluChalla Friday, June 14, 2019 4:24 AM update key information
    Friday, June 14, 2019 3:48 AM

All replies

  • Hi BaluChalla,

    According to your issue, we could use Execute SQL Task and Foreach Loop Container.

    Best Regards,

    Mona


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Friday, June 14, 2019 10:10 AM
  • I would recommend you check the commercial COZYROC File Transfer Task which provides support for SFTP protocol.

    SSIS Tasks Components Scripts Services | http://wwww.cozyroc.com/

    Saturday, June 15, 2019 10:19 PM