I have this SSIS workflow defined. After I explain what I'm doing, it might be possible my approach is wrong, as this is my first "real" SSIS package.
To increment the counter I do this:
public void Main()
{
int i = Convert.ToInt32(Dts.Variables["User::DayCounter"].Value.ToString());
i++;
Dts.Variables["User::DayCounter"].Value = i;
Dts.TaskResult = (int)ScriptResults.Success;
}
My destination table currently looks like this:
PID Campaign Name Company Impr Clicks Clickthru Leads View-Through Leads # Sales # View-Through Sales Sales View-Through Sales Sub Sales View-Through Sub Sales We Get They Get Revenue EPC S U R T Active SourceFile
1734 US - Lending Tree Refinance Mortgage - DA 3 Page SSN Tree.com 58 2,053 3,539.66% 201 0 0 0 0.00 0.00 0.00 0.00 8044.02 5846.00 2198.02 2.85 10% Yes Active \\ad1\Marketing\Aaron\DirectTrackAutomatedReports\admin_program_stats_20120229.csv
My goal is simply to add a column called Day
to the report, containing the value of the counter variable.
Derived Columns Grid Derived Column Name: Specify the derived column name. Derived Column: Select between <add new column> and <replace an existing column> options. Expression: Write the SSIS expression that produce the derived column. Data Type: This column is read-only and it shows the data type of the expression ...
Steps to generate an Auto Incremental Number in SSIS package: - Drag the Script component to the Data flow and select Script component type as Transformation. - Double click the script component. In the input columns tab choose the column you need to pass through script component.
You should add a Derived Column transformation in your Data Flow task between the Flat File Source and OLE DB Destination components.
The Derived Column transformation will add a new column called Day based on your variable.
After that a new Day column will be presented in the data flow. Just map this column to your corresponding database field. (Assume there is a Day column in your report table.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With