Avatar of harry88
harry88

asked on 

Conversion of stored procedure to ssis package

I need to convert below stored procedure to SSIS package.I am kind of new to SSIS. can anyone help me with package. need help. If any one can get me started with package, like where to start and how to approach. or else similar examples or if can do a ssis package for below code.


INSERT INTO simplifiedproductiontracking
            (ordernumber,
             serialnumber,
             catalognumber,
             workcenter,
             status,
             startdate,
             finishdate,
             employees,
             stationid,
             finishshiftid,
             timeelapsedseconds,
             idstart,
             idend)
(SELECT sn.orderid,
        a.serialnumber,
        sa.catalog_number,
        --S.WorkCenter,
        smwc.workcenter,
        b.status,
        a.dateregistered,
        b.dateregistered,
        a.employee + Coalesce('', '' + Nullif(b.employee, a.employee), '''') AS employees,
        a.stationid,
        b.shiftid,
        Datediff(ss, a.dateregistered, b.dateregistered)  AS actualtime,
        a.producttrackid,
        b.producttrackid
FROM   productiontracking AS a WITH (nolock)
        INNER JOIN productiontracking AS b WITH (nolock)
          ON a.serialnumber = b.serialnumber
             AND a.stationid = b.stationid
        INNER JOIN serialnumbers sn WITH (nolock)
          ON a.serialnumber = sn.serialnumber
        INNER JOIN saporders sa WITH (nolock)
          ON sn.orderid = sa.order_number
        INNER JOIN station s WITH (nolock)
          ON a.stationid = s.stationid
        INNER JOIN idealcycletimes ict WITH (nolock)
          ON ict.order_number = sn.orderid
        INNER JOIN sapmultipleworkcenters smwc WITH (nolock)
          ON smwc.stationid = s.stationid
             AND smwc.workcenter = ict.work_center
 WHERE  a.simplified IS NULL
        AND b.simplified IS NULL
        AND ( a.status = 1 AND b.status = 3 )
         OR ( a.status = 4 AND b.status = 6 )
         OR ( a.status = 8 AND b.status = 7 ))

UPDATE productiontracking
SET    simplified = 1
WHERE  simplified IS NULL
       AND EXISTS(SELECT idend
                  FROM   simplifiedproductiontracking
                  WHERE  productiontracking.producttrackid =simplifiedproductiontracking.idend AND
                          productiontracking.serialnumber =  simplifiedproductiontracking.serialnumber)

UPDATE productiontracking
SET    simplified = 1
WHERE  simplified IS NULL
       AND EXISTS(SELECT idstart
                  FROM   simplifiedproductiontracking
                  WHERE  productiontracking.producttrackid = simplifiedproductiontracking.idstart AND
                          productiontracking.serialnumber =simplifiedproductiontracking.serialnumber)  
Microsoft SQL ServerMicrosoft SQL Server 2008Microsoft SQL Server 2005

Avatar of undefined
Last Comment
PedroCGD

8/22/2022 - Mon