所以我在执行SQL任务中做了一些事情,但我的项目经理宁愿在数据流任务中看到它。
INSERT INTO [dbo].[lookup_product]
([dim_global_data_source_id]
,[source_product]
,[source_product_type]
,[source_grade]
,[source_gauge]
,[source_width]
)
SELECT distinct
dim_global_data_source_id,
product_desc,
product_type,
grade,
gauge,
size1
FROM Staging_informix_Coil_is
where not exists
(select source_product
from lookup_product
where lookup_product.dim_global_data_source_id = Staging_informix_Coil_is.dim_global_data_source_id
and isnull(lookup_product.source_product,'') = isnull(Staging_informix_Coil_is.product_desc,'')
and lookup_product.source_product_type = Staging_informix_Coil_is.product_type
and isnull(lookup_product.source_grade,'') = isnull(Staging_informix_Coil_is.grade,'')
and isnull(lookup_product.source_gauge,0) = isnull(Staging_informix_Coil_is.gauge,0)
and isnull(lookup_product.source_width,0) = isnull(Staging_informix_Coil_is.size1,0)
)
`
这是查询。我需要在工作流程中使用它。有人帮我或给我一个样品
答案 0 :(得分:0)
我和你的项目经理在一起。我会创建一个数据流任务。第一个组件是OLE DB源,只包含您的第一个SELECT(无WHERE子句)。
下一个组件是Lookup,从lookup_product中选择您需要匹配的列。在Columns选项卡上,我将匹配WHERE子句中的列。在常规选项卡上,我将其设置为将行重定向到无匹配输出。
最终组件是OLE DB目标,指向lookup_product表。我会使用No Match输出将它连接到Lookup。