Today I was using a 3rd Party Data Flow component that has several Custom Properties for which I need to change some of their values at runtime using a DTS Expression.
To mimic the situation let’s use the “Percentage Sampling” that has two Custom Properties:
Of the two Custom Properties only some (one in this case) are available also outside that dataflow, so that they can be targeted by a DTS Expression. Such properties are listed under the “Misc.” section of Data Flow properties
and also in the Property Expression Editor window:
Now, what if you need to make also the “hidden” custom properties available for DTS Expression usage? As you may have noticed, the SamplingSeed is not exposed outside the Data Flow. I tried to search the web, but after several minutes I gave up since I wasn’t able to find anything that could help. I then started to look into the SSIS object model and I found a nice property named expressionType in the IDTSCustomProperty interface that tells to the engine if the property value can be specified using DTS Expression or not:
If the value is set to Notify than the usage of DTS Expression is possible otherwise, if the property is set to None, as the name implies, DTS Expression cannot be used.
So all you need to do is to open the .dtsx file, look for the component you want to touch and its properties
and add (if not exists) or change the expressionType attribute to Notify:
Save the file and voilà, the property is now available for DTS Expression usage!
Now, just be aware that is a sort of an hack, so double check it works for you. On the 3rd party components we’re using it works like a charm, and it just saved that day since without the ability to change some properties at run time, the deployment of our package in production could have been a nightmare.
I tested this approach both on SQL Server 2012 and SQL Server 2008 and in both cases I hadn’t had any problems.
Hope this helps someone , enjoy!