Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8607327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:19:38+00:00 2026-06-12T03:19:38+00:00

Well, as the title says. I’d like to use a script component destination, and

  • 0

Well, as the title says. I’d like to use a script component destination, and then utilize LINQ to select which rows to process for output.

For a bit more background, I have this ugly merged thing with a one-to-many relationship. The rows look sort of like:

[ID] [Title]   [OneToManyDataID]
1    Item one   2
1    Item one   4
1    Item one   3
3    Item two   1
3    Item two   5

We’ll call the objects [Item], which has the ID and Title columns and [OneToMany]

I was hoping I could throw the entire thing to a script component destination, and then use LINQ to do something like group by the item and only take the data from the highest OneToMany object. Sort of like:

foreach(var item  in Data.GroupBy(d=>d.Item).Select(d=> new {Item = d.Key})){
     //Then pick out the highest OneToMany ID for that row to use with it.
}

I realize there are probably better LINQ queries to accomplish this, but the point is, the script component in SSIS seems to only allow working with it on a per-row basis, with the predefined ProcessInputRow-method. Where I’d like to determine exactly which rows are processed and what properties are passed to that method.

How would I go about doing this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T03:19:40+00:00Added an answer on June 12, 2026 at 3:19 am

    To restate your problem, how can I make an Script Transformation stop processing row-by-row? By default, a script transformation is going to be a synchronous component – 1 row in, 1 row out. You’ll want to change that to an asynchronous component 1 row in – 0 to many rows out.

    On your Script Transformation Editor, the Inputs and Outputs tab, for your output collection Output 0 change the value of SynchronousInputID from whatever it is to None.

    Don’t cast stones on my LINQ code-I trust you can handle making that work right. The intention of this code block is to demonstrate how you would collect your rows for processing and then pass them on to a downstream consumer after modifying them. I commented on the methods to help you understand what each one of them does in the script component life cycle but if you’d rather read MSDN they know a bit more than I do 😉

    using System;
    using System.Data;
    using System.Linq;
    using System.Collections.Generic;
    using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
    using Microsoft.SqlServer.Dts.Runtime.Wrapper;
    
    [Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute]
    public class ScriptMain : UserComponent
    {
        /// <summary>
        /// Our LINQ-able thing.
        /// </summary>
        List<Data> data;
    
        /// <summary>
        /// Do our preexecute tasks, in particular, we will instantiate
        /// our collection.
        /// </summary>
        public override void PreExecute()
        {
            base.PreExecute();
            this.data = new List<Data>();
        }
    
        /// <summary>
        /// This method is called once the last row has hit.
        /// Since we will can only find the highest OneToManyDataId
        /// after receiving all the rows, this the only time we can
        /// send rows to the output buffer.
        /// </summary>
        public override void FinishOutputs()
        {
            base.FinishOutputs();
            CreateNewOutputRows();
        }
    
        /// <summary>
        /// Accumulate all the input rows into an internal LINQ-able
        /// collection
        /// </summary>
        /// <param name="Row">The buffer holding the current row</param>
        public override void Input0_ProcessInputRow(Input0Buffer Row)
        {
            // there is probably a more graceful mechanism of spinning
            // up this struct.
            // You must also worry about fields that have null types.
            Data d = new Data();
            d.ID = Row.ID;
            d.Title = Row.Title;
            d.OneToManyId = Row.OneToManyDataID;            
            this.data.Add(d);
        }
    
        /// <summary>
        /// This is the process to generate new rows. As we only want to
        /// generate rows once all the rows have arrived, only call this
        /// at the point our internal collection has accumulated all the
        /// input rows.
        /// </summary>
        public override void CreateNewOutputRows()
        {
            foreach (var item in this.data.GroupBy(d => d.ID).Select(d => new { Item = d.Key }))
            {
                //Then pick out the highest OneToMany ID for that row to use with it.
                // Magic happens
                // I don't "get" LINQ so I can't implement the poster's action
                int id = 0;
                int maxOneToManyID = 2;
                string title = string.Empty;
                id = item.Item;
                Output0Buffer.AddRow();
                Output0Buffer.ID = id;
                Output0Buffer.OneToManyDataID = maxOneToManyID;
                Output0Buffer.Title = title;
            }
        }
    
    }
    /// <summary>
    /// I think this works well enough to demo
    /// </summary>
    public struct Data
    {
        public int ID { get; set; }
        public string Title { get; set; }
        public int OneToManyId { get; set; }
    }
    

    Configuration of the Script Transformation

    Inputs tab

    Outputs

    results

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Well, like the title says, I want to launch the same java program on
Well, like the title says, i got some performance problems while executing queryForAll on
well, as the title says, I need to create a component inheriting from the
Like the title says, I need to use php (wordwrap or whatever works) to
Well like the title says, how can i check it? i have started something
Well like the title says, how can I connect Outlook with asp.net or any
Well, like the title says I want to populate a ListView with the data
Well, like the title shown, what's the difference between the two class instance variables
Well, question is in title. Is it possible at all? I can use css
Well the title pretty much says it all. I had: $strata = new Zend_Form_Element_Select('strata');

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.