Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从SSIS包中提取映射列_Ssis_Mapping - Fatal编程技术网

从SSIS包中提取映射列

从SSIS包中提取映射列,ssis,mapping,Ssis,Mapping,我正在使用.NET从SSIS包中提取元数据 有没有办法从OLEDB源(没有用于语句的变量)及其目的地提取映射信息?是的,不过您需要深入了解和相关接口的细节才能做到这一点: 使用系统; 使用Microsoft.SqlServer.Dts.Runtime; 使用Microsoft.SqlServer.Dts.Pipeline.Wrapper; 命名空间CSharpConsoleApp { 类包演示 { public void CountColumns(字符串packagePath、字符串dataFl

我正在使用.NET从SSIS包中提取元数据


有没有办法从OLEDB源(没有用于语句的变量)及其目的地提取映射信息?

是的,不过您需要深入了解和相关接口的细节才能做到这一点:

使用系统;
使用Microsoft.SqlServer.Dts.Runtime;
使用Microsoft.SqlServer.Dts.Pipeline.Wrapper;
命名空间CSharpConsoleApp
{
类包演示
{
public void CountColumns(字符串packagePath、字符串dataFlowName)
{
应用程序app=新应用程序();
Package Package=app.LoadPackage(packagePath,null);
TaskHost th=作为TaskHost的package.Executables[dataFlowName];
MainPipe mp=th.InnerObject作为MainPipe;
foreach(mp.ComponentMetaDataCollection中的IDTSComponentMetaData100 md)
{
foreach(md.OutputCollection中的IDTSOutput100输出)
{
WriteLine(“组件{0}输出{1}有{2}列”,
md.Name、output.Name、output.OutputColumnCollection.Count);
foreach(output.OutputColumnCollection中的IDTSOutputColumn100列)
{
WriteLine(“\t列{0}({1})的类型为{2}”,
column.ID、column.Name、column.DataType);
}
}
}
}
}
}

请注意,要编译此代码,您将需要对
Microsoft.SqlServer.ManagedDTS
Microsoft.SqlServer.DtsPipelineWrap
Microsoft.SqlServer.DtsRuntimeWrap
dll的引用。

是的,但您必须深入到相关接口的杂草中才能做到这一点:

使用系统;
使用Microsoft.SqlServer.Dts.Runtime;
使用Microsoft.SqlServer.Dts.Pipeline.Wrapper;
命名空间CSharpConsoleApp
{
类包演示
{
public void CountColumns(字符串packagePath、字符串dataFlowName)
{
应用程序app=新应用程序();
Package Package=app.LoadPackage(packagePath,null);
TaskHost th=作为TaskHost的package.Executables[dataFlowName];
MainPipe mp=th.InnerObject作为MainPipe;
foreach(mp.ComponentMetaDataCollection中的IDTSComponentMetaData100 md)
{
foreach(md.OutputCollection中的IDTSOutput100输出)
{
WriteLine(“组件{0}输出{1}有{2}列”,
md.Name、output.Name、output.OutputColumnCollection.Count);
foreach(output.OutputColumnCollection中的IDTSOutputColumn100列)
{
WriteLine(“\t列{0}({1})的类型为{2}”,
column.ID、column.Name、column.DataType);
}
}
}
}
}
}

请注意,要编译此代码,您需要引用
Microsoft.SqlServer.ManagedDTS
Microsoft.SqlServer.DtsPipelineWrap
Microsoft.SqlServer.DtsRuntimeWrap
DLL。

嗨,Edmund,这是否适用于序列容器中的数据流?当我在序列容器中传递数据流任务的名称时,我认为包中唯一可执行的是容器本身。首先,从包的
可执行文件
集合中获取序列。接下来,从Sequence对象的
Executables
集合中获取数据流。这比从Executables集合中获取数据流要复杂得多。嗨,Edmund,这是否适用于序列容器中的数据流?当我在序列容器中传递数据流任务的名称时,我认为包中唯一可执行的是容器本身。首先,从包的
可执行文件
集合中获取序列。接下来,从Sequence对象的
Executables
集合中获取数据流。这比从Executables集合中获取数据流要复杂得多。