script component | Under the kover of business intelligence https://sqlkover.com BI, SQL Server and data by Koen Verbeeck Wed, 27 Jan 2016 21:01:05 +0000 en-US hourly 1 https://sqlkover.com/wp-content/uploads/2019/11/cropped-sitelogo-32x32.jpg script component | Under the kover of business intelligence https://sqlkover.com 32 32 Reblog: Building the Script Component https://sqlkover.com/reblog-building-the-script-component/?utm_source=rss&utm_medium=rss&utm_campaign=reblog-building-the-script-component https://sqlkover.com/reblog-building-the-script-component/#respond Thu, 28 Jan 2016 13:00:58 +0000 http://sqlkover.com/?p=346 SQLKover update: For some reason, this was my most popular blog post on the old LTD site. Over 110,000 views. People must be building them script components.  The problem From time to time I have to script out some logic using a Script Component in a SSIS package. Business as usual for most developers, but since […]

The post Reblog: Building the Script Component first appeared on Under the kover of business intelligence.]]>

SQLKover update: For some reason, this was my most popular blog post on the old LTD site. Over 110,000 views. People must be building them script components. 

The problem

From time to time I have to script out some logic using a Script Component in a SSIS package. Business as usual for most developers, but since I hardly have a .NET background, it’s always a very stressful experience (I may be over exaggerating a bit). Sometimes it happens I write a little piece of code with a small bug, it happens to the best of us.

public override void Input0_ProcessInputRow(InputBuffer row)
{
    byte test = -1; // do something stupid here
    // rest of the code
}

For those who haven’t noticed: you cannot store -1 in a byte. Anyway, the wonderful designer that is the Visual Studio shell fails to warn me of my little indiscretion. Leaving me with a script component that won’t compile.

nocompile
Yes, that’s SSIS 2008 folks!

The matching errors aren’t helpful either.

errors

The solution

The solution is elegant yet simple: we force the designer to tell us what’s wrong by building the code inside the script component.

button

This results in a blue squiggly being added to the code, together with a decent explanation.

buildscript

The moral of this story: if the script component is giving you a hard time, hit that build button!

The post Reblog: Building the Script Component first appeared on Under the kover of business intelligence.]]>
https://sqlkover.com/reblog-building-the-script-component/feed/ 0