ITPub博客

首页 > Linux操作系统 > Linux操作系统 > ssis ftp get multifiles

ssis ftp get multifiles

原创 Linux操作系统 作者:keeking 时间:2011-09-13 00:04:08 0 删除 编辑

http://www.robsymonds.com/ssis-output-to-multiple-files/

 

 

http://www.sqlservercentral.com/Forums/Topic577774-148-1.aspx

http://www.cozyroc.com/script/get-ftp-file-list-task

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=76989



Foreach Loop Container
Foreach ADO Enumerator
User::a
vCol
vVal
a
Full result set
select col, val from tbale
ResultSet User::a 0
 
 ReadOnlyVariable User::vCol,User::vVal
 Input and output: col1,col2
 
 public override void CreateNewOutputRows()
    {
        /*
          Add rows by calling the AddRow method on the member variable named "Buffer".
          For example, call MyOutputBuffer.AddRow() if your output was named "MyOutput".
        */
      
        Output0Buffer.AddRow();
        Output0Buffer.col = Variables.vCol;
        Output0Buffer.val = Variables.vVal;
    }




 public override void Input0_ProcessInputRow(Input0Buffer Row)
    {
        /*
          Add your code here
        */
      
        string fileLoc = @"c:\" + Row.col;
        FileStream fs = null;
        if (!File.Exists(fileLoc))
        {
            using (fs = File.Create(fileLoc))
            {
                fs.Write(System.Text.Encoding.Default.GetBytes(Row.val), 0, Row.val.Length);
            }
        }
        else
        {
            using (StreamWriter sw = new StreamWriter(fileLoc))
            {
                sw.Write(Row.val);
            }
        }
    }

----------------------------------------------------------------------------------------------------
 
Public Sub Main()
  '
  ' Add your code here
        '
        Dim DestFileName As Variables
        Dim DestPath As Variables
        Dim strTargetFile As String
        Dim strSelectSQL As String
        Dts.VariableDispenser.LockForRead("User::DestPath")
        Dts.VariableDispenser.GetVariables(DestPath)
        Dts.VariableDispenser.LockForRead("User::DestFileName")
        Dts.VariableDispenser.GetVariables(DestFileName)
        strTargetFile = DestPath(0).Value.ToString & DestFileName(0).Value.ToString & ".txt"
        strSelectSQL = "select XmlContent,XMLFileNumber from WeijunHe.dbo.LocalXML where XMLFileName = '" & DestFileName(0).Value.ToString & "'"
        Dts.Variables("User::TargetFile").Value = strTargetFile
        Dts.Variables("User::SelectSQL").Value = strSelectSQL
        DestPath.Unlock()
        DestFileName.Unlock()
  Dts.TaskResult = ScriptResults.Success
 End Sub

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7899089/viewspace-707210/,如需转载,请注明出处,否则将追究法律责任。

上一篇: 巴黎银行面试
请登录后发表评论 登录
全部评论

注册时间:2009-07-23

  • 博文量
    194
  • 访问量
    247711