sql server 2008 r2 - Executing child package in SSIS package store from script task, with a twist -
i have parent package needs execute same child package multiple times. make things more fun, each instance needs have different value defined parent parameter passed child package.
i've created script task using following script:
microsoft.sqlserver.dts.runtime.application app = new microsoft.sqlserver.dts.runtime.application(); package pkg = new package(); try { pkg = app.loadpackage(@"\\server\ssis packages\childpackage.dtsx", null); pkg.variables["childvariablename"].value = dts.variables["aparentvariablename"].value; pkg.execute(); dts.taskresult = (int)scriptresults.success; } catch (exception ex) { dts.events.fireerror(0, "run child pkg parent task", ex.message, string.empty, 0); dts.taskresult = (int)scriptresults.failure; }
problem is, packages stored in ssis package store of sql 2008 r2 server , can't figure out how reference them; every code sample i've seen physical location. on ha cluster having physical location package difficult maintain.
so either need (a) figure out how change value of parentvariable every time execute package task kicked off child package or (b) figure out how reference proper package inside ssis package store, @ point can safely pass proper value. have ideas?
instead of app.loadpackage method, use loadfromsqlserver method
app.loadfromsqlserver("\optionalfolderbutslashrequired\childpackage", "server", null, null, null);
the documentation on application , package have examples in methods i've needed use.
Comments
Post a Comment