Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
请帮助我在ssis中添加列_Ssis - Fatal编程技术网

请帮助我在ssis中添加列

请帮助我在ssis中添加列,ssis,Ssis,嗨,朋友们,我对ssis有点怀疑,请告诉我如何在sql server中解决这个问题 表:患者 pn | cpt1 |cpt2 | cpt3| modi12 | modi13 | modi22 | modi33 | mod31|modi11 1 |100 |200 |300 | a | |g | k | v |q 2 |101 |400 |450 | h | b | |

嗨,朋友们,我对ssis有点怀疑,请告诉我如何在sql server中解决这个问题

表:患者

pn | cpt1 |cpt2 | cpt3| modi12  | modi13  | modi22 | modi33 | mod31|modi11
1  |100   |200  |300  |  a      |         |g       |  k     | v    |q
2  |101   |400  |450  |  h      |   b     |        |        | m    |
此处modi13表示带有cpt3的Modifier1 modi12表示带cpt2的modifier1 modi22表示带cpt2的modifier2 modi33表示带cpt3的modifier3 modi31表示带cpt1的modifier3 modi11表示带cpt1的modifier1 modi13表示带cpt3的modifier1

基于这个条件,我需要这样的输出

       pn  |   cpt   |    modifier1    |   modifier2  | modifier3
       1   |   100   |     q           |             |v
       2   |   101   |                 |             |m
       1   |   200   |     a           |  g          |
       2   |   400   |     h           |             |
       1   |   300   |                 |             |k
       2   |   450   |     b           |             |
我使用unpivot尝试了cpt中存储的cpt1、cpt2、cpt3信息。但这里的问题是如何显示相应的Modifier1、modifier2和modifier3值信息。 从中选择cpt 从patientmain中选择pn、cpt1、cpt2、cpt3 unpivot cpt对于cpt1,cpt2,cpt3sub中的cpt值,此时我只得到pn对应的cpt值


请告诉我。如何在ssis中解决此问题。

如果使用ssis,可以使用多播,例如map

pn | cpt1 | modi11

要创建结果集,请对所有结果集执行此操作

pn | cpt2 | modi21等

然后使用联合任务并将其全部组合在一起

public override void Input0_ProcessInputRow(Input0Buffer Row)
{
    int pn = Row.pn;
    int cpt1 = Row.cpt1;
    int cpt2 = Row.cpt2;
    int cpt3 = Row.cpt3;
    string modi11 = Row.modi11;
    string modi12 = Row.modi12;
    string modi13 = Row.modi13;
    string modi22 = Row.modi22;
    string modi31 = Row.modi31;
    string modi33 = Row.modi33;

    ///modi11 means modifier1 with cpt1 
    ///modi31 means modifier3 with cpt1
    Output0Buffer.AddRow();
    Output0Buffer.pn = pn;

    Output0Buffer.cpt = cpt1;
    Output0Buffer.modifier1 = modi11;
    //Output0Buffer.modifier2 = modi21;
    Output0Buffer.modifier3 = modi31;

    ///modi12 means modifier1 with cpt2 
    ///modi22 means modifier2 with cpt2 
    Output0Buffer.AddRow();
    Output0Buffer.pn = pn;

    Output0Buffer.cpt = cpt2;
    Output0Buffer.modifier1 = modi12;
    Output0Buffer.modifier2 = modi22;
    //Output0Buffer.modifier3 = modi32;

    ///modi13 means modfiere1 with cpt3 
    ///modi33 means modifier3 with cpt3
    Output0Buffer.AddRow();
    Output0Buffer.pn = pn;

    Output0Buffer.cpt = cpt1;
    Output0Buffer.modifier1 = modi13;
    //Output0Buffer.modifier2 = modi23;
    Output0Buffer.modifier3 = modi33;
}

注意:添加代码来处理null,这是特意留给您的-

在SSIS unpivot上搜索会返回大量信息。你为什么不试着举一些例子,把你提出的任何问题都贴出来呢。