2011-12-08 4 views
0

私はssisスクリプトタスクを使用してfilestreamからファイルを取得しようとしていますが、この機能を実現するための標準的なアプローチは、ファイルを保存先フォルダに置きます。ファイルストリームに格納されているファイルをssisスクリプトタスクで取得できますか?

+0

タグとしてazureとsql-azureを入れましたか? –

+0

私のfilestreamには、紺碧の容器から得られたデータが入っています。なぜなら、紺色のタグをつけた理由、つまりsql-azureでタグ付けしてしまったからです。 – mahesh

答えて

1
using System; 

using System.Data; 
using Microsoft.SqlServer.Dts.Pipeline.Wrapper; 
using Microsoft.SqlServer.Dts.Runtime.Wrapper; 
using System.Xml; 

[Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute] 

public class ScriptMain : UserComponent 
{ 
    //Initialize XML Document to read the XML file 
    private XmlDocument xDoc = new XmlDocument(); 

    public override void PreExecute() 
    { 
     base.PreExecute(); 

     //Provide the path to read the XML file and load the xml document 
     xDoc.Load(@"C:\XML Sample\Input.xml"); 

    } 

    public override void CreateNewOutputRows() 
    { 
     //Iterate through each node which has the value "Employee" 
     // "//Employee" is the xpath to fetch all occurences of Employee node in the XML 
     foreach (XmlNode xNode in xDoc.SelectNodes("//Employee")) 
     { 
      //Add new row to the output buffer for each employee node in the XML file 
      this.EmployeeBuffer.AddRow(); 

      //Assign values to the columns. 

      //Read the 1st attribute of the node Employee 
      this.EmployeeBuffer.EmpID= xNode.Attributes[0].Value; 

      //Read the 1st Child node of the node Employee 
      this.EmployeeBuffer.Name= xNode.ChildNodes[0].InnerText; 

      //Read the 2nd Child node of the node Employee 
      this.EmployeeBuffer.Age= xNode.ChildNodes[1].InnerText; 
     } 
    } 

    public override void PostExecute() 
    { 
     base.PostExecute(); 
    } 
} 
+0

このコードをスクリプトの作業に書いていますか? – mahesh

関連する問題