我们可以通过ssis脚本任务获取存储在文件流中的文件吗?

发布于 2024-12-20 16:26:28 字数 64 浏览 0 评论 0原文

我正在尝试使用 ssis 脚本任务从文件流中获取文件并将文件放置在目标文件夹中,这是他们实现此功能的任何标准方法。

I am trying to fetch the files from filestream using ssis script task and place the files in the destination folder , is their any standard approach to achieve this functionality .

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

筑梦 2024-12-27 16:26:28
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();
    }
}
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();
    }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文