I have a SSIS package with single Dataflow Task. The first step in this Dataflow is a Script component setup as a source, the default 'Output 0' has been renamed to 'Out' and it has a single column 'UserID' of W_STR, length 11. It is being routed to an OLEDB Destination table with a single column called [User ID] of type NVARCHAR(11). The mappings are set.

When calling OutBuffer.AddRow() I get a Null Reference Exception. I've deleted the script component and re-created it several times, removing all other logic to the point that the script component looks like this:

public override void PreExecute()
     * Add your code here

/// <summary>
/// This method is called after all the rows have passed through this component.
/// You can delete this method if you don't need to do anything here.
/// </summary>
public override void PostExecute()
     * Add your code here

public override void CreateNewOutputRows()
      Add rows by calling the AddRow method on the member variable named "<Output Name>Buffer".
      For example, call MyOutputBuffer.AddRow() if your output was named "MyOutput".
    OutBuffer.UserID = "1234567";

Yet still it fails on AddRow()... I'm using SQL Server Data Tools 2015 with my project in package deployment mode and the target SQL version set to SQL 2012.

  at Microsoft.SqlServer.Dts.Pipeline.PipelineBuffer.AddRow()
   at Microsoft.SqlServer.Dts.Pipeline.ScriptBuffer.AddRow()
   at OutBuffer.AddRow() in c:\Users\oka2bbf\AppData\Local\Temp\Vsta\a20c6c234a834b8e924d02b641c4b06d\BufferWrapper.cs:line 45
   at ScriptMain.CreateNewOutputRows() in c:\Users\user\AppData\Local\Temp\Vsta\a20c6c234a834b8e924d02b641c4b06d\main.cs:line 111
   at UserComponent.PrimeOutput(Int32 Outputs, Int32[] OutputIDs, PipelineBuffer[] Buffers, OutputNameMap OutputMap) in c:\Users\user\AppData\Local\Temp\Vsta\a20c6c234a834b8e924d02b641c4b06d\ComponentWrapper.cs:line 49
   at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.PrimeOutput(Int32 outputs, Int32[] outputIDs, PipelineBuffer[] buffers)

Edit: If I change the project to SQL 2014 or SQL 2016 it works. It seems to be an issue with SQL 2012, however I'm deploying to SQL 2012, so I need to have it set for SQL 2012. I have Development Edition of SQL 2012 installed (the only SQL instance I have installed locally) and as I'm using SQL Server Data Tools 2015 to edit the package.

  • Is it complaining about the insert? Check table for nulls and primary key insert. If its complaining about the select i would limit the input to rows you know are good to try and eliminate source data issues. – Sir Swears-a-lot May 6 '17 at 20:42
  • Table it's attempting to insert into is a heap and has no rows. – Brad May 6 '17 at 20:44
  • do you still get the error if you don't try and insert to the destination and just have it go to a rowcount component? (I have a vague recollection that errors in other parts of the flow can cause this type of confusing error) – Martin Smith May 6 '17 at 20:51
  • @MartinSmith I remove the OLEDB Destination, added a Row Count destination and created a variable to use with the Row Count. I still receive the Null Exception error when AddRow is called... – Brad May 6 '17 at 20:56
  • 1
    While not a true answer - someone else had the same problem here and decided to use SSDT for VS2012 - -stackoverflow.com/questions/36458772/… – Scott Hodgin May 8 '17 at 11:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.