<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://sqlblog.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Search results matching tags 'ssis' and 'SQL'</title><link>http://sqlblog.com/search/SearchResults.aspx?o=DateDescending&amp;tag=ssis,SQL&amp;orTags=0</link><description>Search results matching tags 'ssis' and 'SQL'</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>SQLSaturday #69 - Philly Love</title><link>http://sqlblog.com/blogs/michael_coles/archive/2011/03/06/sqlsaturday-69-philly-love.aspx</link><pubDate>Mon, 07 Mar 2011 01:38:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:33926</guid><dc:creator>Mike C</dc:creator><description>&lt;P&gt;Thanks to the Philly SQL Server User Group (PSSUG) and to everyone who attended SQLSaturday #69 in the City of Brotherly Love yesterday. It was a great event with a lot of great people.&amp;nbsp;My presentations are&amp;nbsp;available for&amp;nbsp;download at the links below:&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN:0in 0in 10pt;" class=MsoNormal&gt;&lt;A href="http://www.sqlsaturday.com/viewsession.aspx?sat=69&amp;amp;sessionid=3333"&gt;&lt;FONT size=3 face=Calibri&gt;http://www.sqlsaturday.com/viewsession.aspx?sat=69&amp;amp;sessionid=3333&lt;/FONT&gt;&lt;/A&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P style="MARGIN:0in 0in 10pt;" class=MsoNormal&gt;&lt;A href="http://www.sqlsaturday.com/viewsession.aspx?sat=69&amp;amp;sessionid=3334"&gt;&lt;FONT size=3 face=Calibri&gt;http://www.sqlsaturday.com/viewsession.aspx?sat=69&amp;amp;sessionid=3334&lt;/FONT&gt;&lt;/A&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P&gt;I just went through&amp;nbsp;my speaker evaluations, and I'm happy to report the response was pretty positive across the board. Having lived in Philly, I know Philadelphians aren't shy about telling how they really feel, so I really appreciate the positive feedback.&lt;/P&gt;
&lt;P&gt;For those of you who wrote comments with areas for improvement, rest assured I appreciate the feedback and I'll work your suggestions into future presentations!&lt;/P&gt;
&lt;P&gt;Next stop is SQLSaturday #71 in Boston (&lt;A href="http://www.sqlsaturday.com/71/eventhome.aspx"&gt;http://www.sqlsaturday.com/71/eventhome.aspx&lt;/A&gt;). Lots of top-notch speakers presenting at this one, and I'm looking forward to learning a little Power Shell from the master, and maybe learn a little bit o' that DBA stuff&amp;nbsp;this time around :)&lt;/P&gt;
&lt;P&gt;See you in Boston!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description></item><item><title>Try-N-Save SSIS Packages</title><link>http://sqlblog.com/blogs/michael_coles/archive/2010/11/29/try-n-save-ssis-packages.aspx</link><pubDate>Mon, 29 Nov 2010 05:17:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:31096</guid><dc:creator>Mike C</dc:creator><description>&lt;P&gt;The Try-N-Save SSIS Packages from my SSIS Dimensional Data Optimization presentation are available at &lt;A href="http://cid-8f7e6c950afc6b3e.office.live.com/self.aspx/.Public/Presentation/TryNSave.zip"&gt;http://cid-8f7e6c950afc6b3e.office.live.com/self.aspx/.Public/Presentation/TryNSave.zip&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;I'm still working on getting the sample database uploaded - even compressed a backup is larger than SkyDrive's upload filesize limit. I'll script it out when I have time (in addition to DDL, there are some tables that need to be prepopulated).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description></item><item><title>High Performance Dimensional Data Loads With SSIS Presentation</title><link>http://sqlblog.com/blogs/michael_coles/archive/2010/11/20/high-performance-dimensional-data-loads-with-ssis-presentation.aspx</link><pubDate>Sat, 20 Nov 2010 18:25:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:30834</guid><dc:creator>Mike C</dc:creator><description>&lt;P&gt;Just finished giving the SSIS High-Performance Dimensional Data Load presentation at &lt;A title="SQLSaturday #59 NYC" href="http://www.sqlsaturday.com/59/schedule.aspx"&gt;SQLSaturday #59 NYC&lt;/A&gt;.&amp;nbsp; Here are the slides in PDF format.&amp;nbsp; I'll upload the Try-N-Save&amp;nbsp;code and sample data later for attendees to play with.&lt;/P&gt;
&lt;P&gt;Thanks to everyone who attended my session and thanks to Melissa D. and NJSQL for putting this together.&amp;nbsp; For those who are interested in Alejandro Mesa's composable DML solution to the problem of Type 2 dimension updates, here's the complete statement from the demo:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;INSERT INTO Dim.Geography_Hash&lt;BR&gt;(&amp;nbsp;&lt;BR&gt;&amp;nbsp;CityName, CountyFIPS, CountyName, StateFIPS, &lt;BR&gt;&amp;nbsp;StateUSPS, StateName, ZIP, TimeOffset, &lt;BR&gt;&amp;nbsp;DaylightSavingTime, StartDateID, CurrentFlag, BatchID, &lt;BR&gt;&amp;nbsp;LineageID, CubeInd, SortOrder, Hash&lt;BR&gt;)&lt;BR&gt;SELECT CityName, CountyFIPS, CountyName, StateFIPS, &lt;BR&gt;&amp;nbsp;StateUSPS, StateName, ZIP, TimeOffset, &lt;BR&gt;&amp;nbsp;DaylightSavingTime, StartDateID, CurrentFlag, BatchID, &lt;BR&gt;&amp;nbsp;LineageID, CubeInd, SortOrder, Hash&lt;BR&gt;FROM&lt;BR&gt;(&lt;BR&gt;&amp;nbsp;MERGE INTO Dim.Geography_Hash AS Target&lt;BR&gt;&amp;nbsp;USING Staging.Geography_Hash AS Source&lt;BR&gt;&amp;nbsp;ON Target.ZIP = Source.ZIP&lt;BR&gt;&amp;nbsp;&amp;nbsp;AND Target.CurrentFlag = Source.CurrentFlag&lt;BR&gt;&amp;nbsp;WHEN MATCHED AND Target.Hash &amp;lt;&amp;gt; Source.Hash&lt;BR&gt;&amp;nbsp;&amp;nbsp;THEN UPDATE SET CurrentFlag = 'N'&lt;BR&gt;&amp;nbsp;WHEN NOT MATCHED&lt;BR&gt;&amp;nbsp;&amp;nbsp;THEN INSERT &lt;BR&gt;&amp;nbsp;&amp;nbsp;(&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;CityName, CountyFIPS, CountyName, StateFIPS, &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;StateUSPS, StateName, ZIP, TimeOffset, &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;DaylightSavingTime, StartDateID, CurrentFlag, BatchID, &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;LineageID, CubeInd, SortOrder, Hash&lt;BR&gt;&amp;nbsp;&amp;nbsp;)&lt;BR&gt;&amp;nbsp;&amp;nbsp;VALUES&lt;BR&gt;&amp;nbsp;&amp;nbsp;(&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Source.CityName, Source.CountyFIPS, Source.CountyName, Source.StateFIPS, &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Source.StateUSPS, Source.StateName, Source.ZIP, Source.TimeOffset, &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Source.DaylightSavingTime, Source.StartDateID, Source.CurrentFlag, Source.BatchID, &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Source.LineageID, Source.CubeInd, Source.SortOrder, Source.Hash&lt;BR&gt;&amp;nbsp;&amp;nbsp;)&lt;BR&gt;&amp;nbsp;OUTPUT $action, inserted.CityName, inserted.CountyFIPS, inserted.CountyName, inserted.StateFIPS, &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;inserted.StateUSPS, inserted.StateName, inserted.ZIP, inserted.TimeOffset, &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;inserted.DaylightSavingTime, inserted.StartDateID, inserted.CurrentFlag, inserted.BatchID, &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;inserted.LineageID, inserted.CubeInd, inserted.SortOrder, inserted.Hash&lt;BR&gt;)&lt;BR&gt;AS T &lt;BR&gt;(&lt;BR&gt;&amp;nbsp;action, CityName, CountyFIPS, CountyName, StateFIPS, &lt;BR&gt;&amp;nbsp;StateUSPS, StateName, ZIP, TimeOffset, &lt;BR&gt;&amp;nbsp;DaylightSavingTime, StartDateID, CurrentFlag, BatchID, &lt;BR&gt;&amp;nbsp;LineageID, CubeInd, SortOrder, Hash&lt;BR&gt;)&lt;BR&gt;WHERE action = 'UPDATE';&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;As mentioned, the OUTPUT clause on the inner MERGE statement feeds the outer INSERT clause.&amp;nbsp; Next stop&amp;nbsp;is &lt;A title="SQLSaturday #61 DC" href="http://www.sqlsaturday.com/61/schedule.aspx"&gt;SQLSaturday #61 in&amp;nbsp;DC&lt;/A&gt; at the beginning of December.&lt;/P&gt;</description></item><item><title>It's Official - SQLSaturday is Coming to NYC!</title><link>http://sqlblog.com/blogs/michael_coles/archive/2010/02/06/it-s-official-sqlsaturday-is-coming-to-nyc.aspx</link><pubDate>Sat, 06 Feb 2010 19:59:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:21916</guid><dc:creator>Mike C</dc:creator><description>&lt;P&gt;&lt;A title="NJSQL Home Page" href="http://www.njsql.org/" target=_blank&gt;New Jersey SQL Server User Group (NJSQL)&lt;/A&gt; is bringing &lt;A title="SQLSaturday #39 Home Page" href="http://www.sqlsaturday.com/39/eventhome.aspx" target=_blank&gt;SQLSaturday #39&lt;/A&gt;&amp;nbsp;to NYC on April 24, 2010!&amp;nbsp; The free all-day training event will be hosted by Microsoft at their Midtown Manhattan offices.&amp;nbsp; The speaker line-up is growing fast—if you'd like to present, visit the event's open &lt;A title="SQLSaturday #39 Call for Speakers" href="http://www.sqlsaturday.com/39/callforspeakers.aspx" target=_blank&gt;call for speakers&lt;/A&gt;.&amp;nbsp;&amp;nbsp;This is a free full-day training&amp;nbsp;event, but &lt;A title="SQLSaturday #39 Registration Page" href="http://www.sqlsaturday.com/39/register.aspx" target=_blank&gt;registration is required&lt;/A&gt;&amp;nbsp;to attend.&amp;nbsp; Seating is limited.&lt;/P&gt;
&lt;P&gt;Registration, speaker, and sponsorship details are posted at &lt;A href="http://www.sqlsaturday.com/39/eventhome.aspx"&gt;http://www.sqlsaturday.com/39/eventhome.aspx&lt;/A&gt;.&lt;/P&gt;</description></item><item><title>&amp;quot;SQL Server MVP Deep Dives&amp;quot; Book Available for Early Access/Pre-Orders</title><link>http://sqlblog.com/blogs/michael_coles/archive/2009/09/16/sql-server-mvp-deep-dives-book-available-for-early-access-pre-orders.aspx</link><pubDate>Thu, 17 Sep 2009 00:21:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:16825</guid><dc:creator>Mike C</dc:creator><description>&lt;P&gt;The MVP authored book, &lt;STRONG&gt;&lt;EM&gt;SQL Server MVP Deep Dives&lt;/EM&gt;&lt;/STRONG&gt; is now available for early access and pre-orders at &lt;A href="http://manning.com/nielsen/"&gt;http://manning.com/nielsen/&lt;/A&gt;.&amp;nbsp;&amp;nbsp;The book is divided into 5 sections that cover everything from building a proper relational database to developing BI solutions:&lt;/P&gt;
&lt;P&gt;1. Database Design and Architecture &lt;BR&gt;2. Database Development &lt;BR&gt;3. Database Administration &lt;BR&gt;4. Performance Tuning and Optimization&lt;BR&gt;5. BI Development&lt;/P&gt;
&lt;P&gt;This book covers a lot of ground with a lot of expert tour guides. Weighing in at 850 pages, it was written, tech-reviewed and edited by dozens of&amp;nbsp;Microsoft MVPs with intimate knowledge of SQL Server.&amp;nbsp; The contributor list includes some of the biggest names in SQL Server: Paul Nielsen, Adam Machanic, Kalen Delaney, Itzik Ben-Gan, Aaron Bertrand, Hugo Kornelis, John Paul Cook, and several others.&amp;nbsp; For me getting a copy of this book will be like getting the opportunity to pick the brains of some of the most knowledgable folks in the industry on a wide variety of topics.&lt;/P&gt;
&lt;P&gt;This is already one of my favorite books that I've had the chance to contribute to (I wrote a couple of chapters discussing on SQL Server XML in general and SQL Server XQuery specifically) because all of the royalties go to a charity that helps children who are war victims!&lt;/P&gt;
&lt;P&gt;So go get the book, learn what the pros know, and do your good deed for the day -- all at the same time!&lt;/P&gt;
&lt;P&gt;You can get more info on &lt;STRONG&gt;&lt;EM&gt;SQL Server MVP Deep Dives&lt;/EM&gt;&lt;/STRONG&gt; at Manning Publications: &lt;A href="http://manning.com/nielsen/"&gt;http://manning.com/nielsen/&lt;/A&gt;&amp;nbsp;and at Amazon&amp;nbsp;&lt;A href="http://www.amazon.com/SQL-Server-MVP-Deep-Dives/dp/1935182048/"&gt;http://www.amazon.com/SQL-Server-MVP-Deep-Dives/dp/1935182048/&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;A href="http://manning.com/nielsen/"&gt;&lt;IMG style="WIDTH:150px;HEIGHT:186px;" title="SQL Server Deep Dives" border=1 alt="SQL Server Deep Dives" src="http://manning.com/nielsen/nielsen_cover150.jpg" width=150 height=186&gt;&lt;/A&gt;&lt;/P&gt;</description></item><item><title>SSIS: living in a parallel world? Not yet...</title><link>http://sqlblog.com/blogs/alberto_ferrari/archive/2008/09/14/ssis-living-in-a-parallel-world-not-yet.aspx</link><pubDate>Sun, 14 Sep 2008 19:57:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:8899</guid><dc:creator>AlbertoFerrari</dc:creator><description>&lt;P&gt;Today I come into a nice bug (misfeature?) of SSIS 2008 and I'd like to share it with you. Let's start from the beginning:&lt;/P&gt;
&lt;P&gt;One of the keys to make something speedy is to parallelize it. In TableDifference I read from two inputs, compare them and produce several outputs for new, deleted, updated rows and so on. It is the classical "produce/consumer" paradigm that works fine in parallel, creating a consumer thread that compares rows and different threads to produce them. &lt;/P&gt;
&lt;P&gt;During the porting of the component in SQL 2008 I discovered that my code does not work as expected. It reads all the lines, then terminates abnormally without producing a single row of output. It took me a couple of hours and several coffes to discover the change in the way SSIS handles asyncronous components causing my bug.&lt;/P&gt;
&lt;P&gt;In order to make the problem easier to understand (for microsoft connect too), I produced the same behaviour with a much simpler script component. Imagine to have a script transformation that needs to make some very complex work on each row. You will end up with something like this:&lt;/P&gt;&lt;PRE class=csharpcode&gt;    &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;override&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;void&lt;/SPAN&gt; Input0_ProcessInputRow(Input0Buffer Row) {
        Output0Buffer.AddRow();
        Output0Buffer.LineID = VeryComplexFunction(Row);
        &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (Row.EndOfRowset ()) {
           OutputBuffer.SetEndOfRowset ();
        }
    }&lt;/PRE&gt;
&lt;P&gt;But, if you have a 64 CPU computer. You can imagine to detach many threads, each one handling just one very complex function, in this way you will produce a massive parallel computation. Wow! The solution to get maximum speed would be this:&lt;/P&gt;&lt;PRE class=csharpcode&gt;    &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;override&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;void&lt;/SPAN&gt; Input0_ProcessInputRow(Input0Buffer Row) {
        Thread T = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; Thread(SendAsyncRow);
        T.Start(Row.EndOfRowset());
    }

    &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;void&lt;/SPAN&gt; SendAsyncRow(Object O) {
        Output0Buffer.AddRow();
        Output0Buffer.LineID = VeryComplexFunction();
        &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; ((&lt;SPAN class=kwrd&gt;bool&lt;/SPAN&gt;)O == &lt;SPAN class=kwrd&gt;true&lt;/SPAN&gt;) {
            Output0Buffer.SetEndOfRowset();
        }
    }&lt;/PRE&gt;
&lt;P&gt;You detach a separate thread for each row, the thread will compute the very complex function and send it to the output buffer as soon as it is ready. In order to make SSIS understand when everything is finished, you signal SetEndOfRowset in the last thread.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;EM&gt;Don't start crying, this code will never work, the SetEndOfRowset is called on the last read line and not on the last produced one, but this is just pseudocode to understand the topic, don't blame me for inconsistencies. :) Let's go on with the main topic.&lt;/EM&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Under SSIS 2005 this code (in VB, of course) would work fine as the engine detects the end of processing when it receives the EndOfRowset on the outputs. In SSIS 2008 the engine detects the end of the processing as soon as the &lt;EM&gt;&lt;STRONG&gt;last call to ProcessInputRow has finished&lt;/STRONG&gt;&lt;/EM&gt;. So, in our case, after the last thread has been detached SSIS believes that the processing is finished and calls the cleaning up of the component, completely ignoring both the presence of separate threads running and our williness to not terminate the component because we know that we need some more time.&lt;/P&gt;
&lt;P&gt;The result? As with any other parallel bug you will sometime get a crash, on the same inputs sometime finish corectly, sometime get an error... the nightmare of any programmer.&lt;/P&gt;
&lt;P&gt;If you want to try it by yourself, cut and paste this code to a transformation script in a data flow that process some lines ( rows 10/20 lines are enough):&lt;/P&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;using&lt;/SPAN&gt; System;
&lt;SPAN class=kwrd&gt;using&lt;/SPAN&gt; System.Data;
&lt;SPAN class=kwrd&gt;using&lt;/SPAN&gt; Microsoft.SqlServer.Dts.Pipeline.Wrapper;
&lt;SPAN class=kwrd&gt;using&lt;/SPAN&gt; Microsoft.SqlServer.Dts.Runtime.Wrapper;

&lt;SPAN class=kwrd&gt;using&lt;/SPAN&gt; System.Threading;

[Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute]
&lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;class&lt;/SPAN&gt; ScriptMain : UserComponent {

    &lt;SPAN class=kwrd&gt;bool&lt;/SPAN&gt; useThreads = &lt;SPAN class=kwrd&gt;false&lt;/SPAN&gt;;

    &lt;SPAN class=rem&gt;/// &amp;lt;summary&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=rem&gt;/// &lt;/SPAN&gt;
    &lt;SPAN class=rem&gt;/// Processes input rows&lt;/SPAN&gt;
    &lt;SPAN class=rem&gt;/// &lt;/SPAN&gt;
    &lt;SPAN class=rem&gt;/// &amp;lt;/summary&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=rem&gt;/// &amp;lt;param name="Row"&amp;gt;&amp;lt;/param&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;override&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;void&lt;/SPAN&gt; Input0_ProcessInputRow(Input0Buffer Row) {
        Thread T = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; Thread(SendAsyncRow);

        &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (useThreads) {
            T.Start(Row.EndOfRowset());
        } &lt;SPAN class=kwrd&gt;else&lt;/SPAN&gt; {
            SendRow();
        }
    }

    &lt;SPAN class=rem&gt;/// &amp;lt;summary&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=rem&gt;/// &lt;/SPAN&gt;
    &lt;SPAN class=rem&gt;/// Sends a row in sync mode&lt;/SPAN&gt;
    &lt;SPAN class=rem&gt;/// &lt;/SPAN&gt;
    &lt;SPAN class=rem&gt;/// &amp;lt;/summary&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=kwrd&gt;private&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;void&lt;/SPAN&gt; SendRow() {
        &lt;SPAN class=rem&gt;// Thread.Sleep(100);&lt;/SPAN&gt;
        Output0Buffer.AddRow();
        Output0Buffer.LineID = VeryComplexFunction();
    }

    &lt;SPAN class=rem&gt;/// &amp;lt;summary&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=rem&gt;/// &lt;/SPAN&gt;
    &lt;SPAN class=rem&gt;/// Sends a row in async mode&lt;/SPAN&gt;
    &lt;SPAN class=rem&gt;/// &lt;/SPAN&gt;
    &lt;SPAN class=rem&gt;/// &amp;lt;/summary&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=rem&gt;/// &amp;lt;param name="O"&amp;gt;&amp;lt;/param&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;void&lt;/SPAN&gt; SendAsyncRow(Object O) {
        Thread.Sleep(100);
        Output0Buffer.AddRow();
        Output0Buffer.LineID = VeryComplexFunction();
        &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; ((&lt;SPAN class=kwrd&gt;bool&lt;/SPAN&gt;)O == &lt;SPAN class=kwrd&gt;true&lt;/SPAN&gt;) {
            Output0Buffer.SetEndOfRowset();
        }
    }

    &lt;SPAN class=rem&gt;/// &amp;lt;summary&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=rem&gt;/// &lt;/SPAN&gt;
    &lt;SPAN class=rem&gt;/// Not very complex... but it's a demo!&lt;/SPAN&gt;
    &lt;SPAN class=rem&gt;/// &lt;/SPAN&gt;
    &lt;SPAN class=rem&gt;/// &amp;lt;/summary&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=rem&gt;/// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=kwrd&gt;private&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;int&lt;/SPAN&gt; VeryComplexFunction() {
        &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt; 10;
    }
}&lt;/PRE&gt;
&lt;P&gt;using Serial mode (useThreads se to false) everything works fine. Using parallel mode (useThreads set to true) SSIS will crash and produce no output at all. The bug in TableDifference was very similar to that, I needed to handle the wait for termination of the consumer process during the ProcessInput function.&lt;/P&gt;
&lt;P&gt;It is not the first time I discover inconsistencies in the way SSIS handles parallelism, in order to try to make it easier to write code (using 2008 mode there is no need to call SetEndOfRowset and your program will run fine if you forget it) the architects of SSIS introduce a behavior that will make better and correct code crash. If you believe this is a problem, vote &lt;A href="https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=367692" target=_blank&gt;here&lt;/A&gt;, anyway... be aware of it, it mighe be useful in the future. :)&lt;/P&gt;</description></item><item><title>Mantaining order in SSIS flow, problems with Merge</title><link>http://sqlblog.com/blogs/alberto_ferrari/archive/2007/04/10/mantaining-order-in-ssis-flow-problems-with-merge.aspx</link><pubDate>Tue, 10 Apr 2007 06:48:26 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:1896</guid><dc:creator>AlbertoFerrari</dc:creator><description>&lt;p&gt;In a &lt;a href="http://sqlblog.com/blogs/alberto_ferrari/archive/2007/04/08/making-fast-load-really-fast-on-clustered-indexed-tables-with-ssis.aspx"&gt;previous post&lt;/a&gt; I spoke about the advantages of having sorted flows in SSIS to greatly speed up data insertion using fastload. The need to have a sorted flow brings some severe problems to the SSIS programmer that he need to be aware of and that IMHO Microsoft should address with a future implementation of SQL Server.  &lt;p&gt;Let’s have a look at the problem. &lt;p&gt;In the image you can see a very typical SSIS data flow where you need to manage the error flow of a lookup component and go on with the processing. Even if you can’t see it from the picture, think that Sample Source will produce a sorted output of several millions rows and we want to insert into TestTable with the same sorting.  &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/alberto_ferrari/WindowsLiveWriter/MantainingorderinSSISflowproblemswithMer_9222/Merge%20using%20Union%20All.png"&gt;&lt;img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px;" height="325" alt="Merge using Union All" src="http://sqlblog.com/blogs/alberto_ferrari/WindowsLiveWriter/MantainingorderinSSISflowproblemswithMer_9222/Merge%20using%20Union%20All_thumb.png" width="364" border="0"&gt;&lt;/a&gt;  &lt;p&gt;This task works fine but it has a big problem: the Union All component will lose the sorting of the flow as it will handle data from both its input in an unordered way. This is not a bug, Union All has its behaviour by design. Still we have a problem and we know that sorting several millions rows after the Union All component is not an option for memory consumption. &lt;p&gt;In SSIS you have another component, Merge, that will kindly maintain the order of its inputs, so you can change your package this way: &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/alberto_ferrari/WindowsLiveWriter/MantainingorderinSSISflowproblemswithMer_9222/Merge%20using%20Merge.png"&gt;&lt;img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px;" height="320" alt="Merge using Merge" src="http://sqlblog.com/blogs/alberto_ferrari/WindowsLiveWriter/MantainingorderinSSISflowproblemswithMer_9222/Merge%20using%20Merge_thumb.png" width="353" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;Everything will work fine until you have a package that should handle several millions rows where only a very few of them (say 1.000) will enter the lookup error output flow. &lt;p&gt;In such a situation Merge will start caching ALL the rows from its first input (the row that correctly matched lookup) until something will come from its second input (rows coming from the Derived Column task). The problem is that SSIS will NOT call the ProcessInput method of the Derived Column task until its buffer reaches a certain amount of rows (normally 10.000 or a number like it) and this will not happen because only 1.000 rows will enter the Derived Column path. In such a situation Merge will start consuming memory and will fill up all the available memory really fast leading to crashes and/or very poor performances. &lt;p&gt;Even this behavior of both Merge and SSIS is “by design”, so we cannot complain it. But it could be easily solved setting the max number of rows of the buffer in the Derived column to 1 in order to call ProcessInput immediately (if I know what kind of data I will read I can easily set up values that make my SSIS package run faster). Unfortunately there is no such kind of option in SSIS so, at present, the problem cannot be solved. &lt;p&gt;Needless to say, even if this is a problem, you can try to make your sorted package run without any merge component and you will be able to maintain the sort of the flow but this is a really big limitation in expressivity of your ETL algorithm so awareness of the problem is mandatory to successfully complete your ETL process.</description></item></channel></rss>