Question

So I have something that I did in an execute SQL task but my project manager would rather see it in a data flow task.

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)
)  

`

That's the query. I need this in a workflow. Someone help me out or give me a sample

Was it helpful?

Solution

I'm with your project manager on this one. I would create a Data Flow Task. The first component would be an OLE DB Source, containing just your first SELECT (no WHERE clause).

The next component would be a Lookup, selecting the columns you need to match on from lookup_product. On the Columns tab I would match the columns as you have in your WHERE clause. On the General tab I would set it to Redirect Rows to No Match output.

The final component is an OLE DB Destination, pointing at the lookup_product table. I would connect this to the Lookup using the No Match output.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top