troubleshooting Question

Conversion of stored procedure to ssis package

Avatar of harry88
harry88 asked on
Microsoft SQL ServerMicrosoft SQL Server 2008Microsoft SQL Server 2005
7 Comments1 Solution718 ViewsLast Modified:
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)  
ASKER CERTIFIED SOLUTION
Reza Rad
Consultant, Trainer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros