开发者

Reusing tasks in SSIS

开发者 https://www.devze.com 2023-01-15 02:21 出处:网络
How can a task be reu开发者_运维百科sed in SSIS without copy/paste? For example, I\'d like to use the tasks I\'ve defined in an event handler for one executable in another executable, but not with al

How can a task be reu开发者_运维百科sed in SSIS without copy/paste?

For example, I'd like to use the tasks I've defined in an event handler for one executable in another executable, but not with all executables in the package. So far, I haven't found any solutions other than writing a complete custom component, which seems like overkill. Any suggestions?


Have you considered using an event at the package level, and filtering to only fire when your particular condition requires it?
E.g. you could use the OnPostExecute event just by putting a dummy task in your flow with a name that starts with a specific string like "RunMyTasks", and then check the System::SourceName to see if it starts with "RunMyTasks". If it does, then branch to run your tasks (and otherwise branch to handle the event as you normally would).

You could do a similar thing using OnVariableValueChanged - this might be better (although you'd need to test it). Create a variable with RaiseChangedEvent=TRUE. Create a script task / component to change the value of the variable; finally, put your task set into the event handler. Check the scoping notes at the bottom of Jamie's post here.


If you can use third-party solutions, check the commercial CozyRoc SSIS+ library. It includes enhanced Script Task Plus, which allows export of script to external file and then link and reuse in other packages.

0

精彩评论

暂无评论...
验证码 换一张
取 消