We help IT Professionals succeed at work.
Get Started

Conversion of stored procedure to ssis package

711 Views
Last Modified: 2013-11-10
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)  
Comment
Watch Question
Consultant, Trainer
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 7 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE