且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在另一列的基础上过滤一列中的数据值,然后将值插入同一SQL表中的不同列中

更新时间:2022-01-17 22:42:35

您可以使用脚本组件来实现:

  1. 添加脚本组件
  2. 转到输入和输出"标签
  3. 添加3个输出列:ID,出生日期,角色
  4. 将SynchronousInput属性设置为None
  1. Add a script component
  2. Go to the Inputs and Outputs tab
  3. Add 3 Output columns : ID, BirthDate, Role
  4. Set the SynchronousInput property to None

  1. 在脚本编辑器中,编写类似的脚本:

string ID = "";
string BirthDate = "";
string Role = "";
public override void Input0_ProcessInputRow(Input0Buffer Row)
{
   if(!Row.Attribute_IsNull && !String.IsNullOrWhiteSpace(Row.Attribute))
    {

        switch (Row.Attribute)
        {

            case "ID":
                ID = Row.AttributeType;
                break;

            case "BirthDate":
                BirthDate = Row.AttributeType;
                break;

            case "Role":
                Role = Row.AttributeType;

                Output0Buffer.AddRow();
                Output0Buffer.ID = ID;
                Output0Buffer.Role = Role;
                Output0Buffer.BirthDate = BirthDate;

                break;
            default:
                break;
        }
    }
}

  1. 将输出"列映射到OLE DB目标