Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

need some help in simple script component transformation

$
0
0

I have a variable which holds a integer value

Inside the script component I need to use that integer value (variable ) and increment by 1 and assign to a output column

so here what I did

/* Microsoft SQL Server Integration Services Script Component
*  Write scripts using Microsoft Visual C# 2008.
*  ScriptMain is the entry point class of the script.*/
using System;
using System.Data;
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
using Microsoft.SqlServer.Dts.Runtime.Wrapper;
using System.Windows.Forms;
[Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute]
public class ScriptMain : UserComponent
{
    int test;
    public override void PreExecute()
    {
        base.PreExecute();
        /*
          Add your code here for preprocessing or remove if not needed
        */
    }
    public override void PostExecute()
    {
        base.PostExecute();
        /*
          Add your code here for postprocessing or remove if not needed
          You can set read/write variables here, for example:
          Variables.MyIntVar = 100
        */
     test = Variables.currentvalue;
    }
    public override void Input0_ProcessInputRow(Input0Buffer Row)
    {
        Row.nextvalue = test + 1;
        test++;
    }
}

For the script I selected currentvalue variable as read only variable and in Variable value I assigned lets say 100

but when I ran the package  nextvalue rather than starting from 100 it starts from 1

can any one help me


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>