Users Online

We have 16 guests online
Delete Parts SQL PDF Print E-mail
Written by Zack MIlls   
Friday, 25 September 2009 12:32

 

 

--SQL to Delete all Part Specific Data

 

 

DELETE FROM tbl_SO_Data

FROM tbl_SO_Parent_Child AS C RIGHT OUTER JOIN

tbl_SO_StepData AS A ON C.CID = A.StepID LEFT OUTER JOIN

tbl_SO_Data ON A.StepID = tbl_SO_Data.StepID

WHERE (A.FlowStepName = N'RC_Flow')

DELETE FROM tbl_SO_Data

FROM tbl_SO_Parent_Child AS C RIGHT OUTER JOIN

tbl_SO_StepData AS A ON C.CID = A.StepID LEFT OUTER JOIN

tbl_SO_Data ON A.StepID = tbl_SO_Data.StepID

WHERE (A.FlowStepName = N'RI_Flow')

DELETE FROM tbl_SO_Data

FROM tbl_SO_Parent_Child AS C RIGHT OUTER JOIN

tbl_SO_StepData AS A ON C.CID = A.StepID LEFT OUTER JOIN

tbl_SO_Data ON A.StepID = tbl_SO_Data.StepID

WHERE (A.FlowStepName = N'RQ_Flow')

DELETE FROM tbl_SO_Data

FROM tbl_SO_Parent_Child AS C RIGHT OUTER JOIN

tbl_SO_StepData AS A ON C.CID = A.StepID LEFT OUTER JOIN

tbl_SO_Data ON A.StepID = tbl_SO_Data.StepID

WHERE (A.FlowStepName = N'LT_Flow'

 

DELETE FROM tbl_SO_Data

FROM tbl_SO_Parent_Child AS C RIGHT OUTER JOIN

tbl_SO_StepData AS A ON C.CID = A.StepID LEFT OUTER JOIN

tbl_SO_Data ON A.StepID = tbl_SO_Data.StepID

WHERE (A.FlowStepName = N'PSR_Flow')

 

DELETE FROM tbl_SO_Data

FROM tbl_SO_Parent_Child AS C RIGHT OUTER JOIN

tbl_SO_StepData AS A ON C.CID = A.StepID LEFT OUTER JOIN

tbl_SO_Data ON A.StepID = tbl_SO_Data.StepID

WHERE (A.FlowStepName = N'PR_Flow')

 

DELETE FROM tbl_SO_Data

FROM tbl_SO_Parent_Child AS C RIGHT OUTER JOIN

tbl_SO_StepData AS A ON C.CID = A.StepID LEFT OUTER JOIN

tbl_SO_Data ON A.StepID = tbl_SO_Data.StepID

WHERE (A.FlowStepName = N'NVR_Flow')


DELETE FROM tbl_SO_Data

FROM tbl_SO_Parent_Child AS C RIGHT OUTER JOIN

tbl_SO_StepData AS A ON C.CID = A.StepID LEFT OUTER JOIN

tbl_SO_Data ON A.StepID = tbl_SO_Data.StepID

WHERE (A.FlowStepName = N'EVR_Flow')


 

DELETE FROM tbl_SO_Data

FROM tbl_SO_Parent_Child AS C RIGHT OUTER JOIN

tbl_SO_StepData AS A ON C.CID = A.StepID LEFT OUTER JOIN

tbl_SO_Data ON A.StepID = tbl_SO_Data.StepID

WHERE (A.FlowStepName = N'FR_Flow')

 

DELETE FROM tbl_SO_Data

FROM tbl_SO_Parent_Child AS C RIGHT OUTER JOIN

tbl_SO_StepData AS A ON C.CID = A.StepID LEFT OUTER JOIN

tbl_SO_Data ON A.StepID = tbl_SO_Data.StepID

WHERE (A.FlowStepName = N'RP_Flow')

 

DELETE FROM tbl_SO_Data

FROM tbl_SO_Parent_Child AS C RIGHT OUTER JOIN

tbl_SO_StepData AS A ON C.CID = A.StepID LEFT OUTER JOIN

tbl_SO_Data ON A.StepID = tbl_SO_Data.StepID

WHERE (A.FlowStepName = N'FSR_Flow')

 

DELETE FROM tbl_SO_Data

FROM tbl_SO_Parent_Child AS C RIGHT OUTER JOIN

tbl_SO_StepData AS A ON C.CID = A.StepID LEFT OUTER JOIN

tbl_SO_Data ON A.StepID = tbl_SO_Data.StepID

WHERE (A.FlowStepName = N'SoftDel')

 

DELETE FROM tbl_SO_StepData

WHERE (FlowStepName = N'LT_Flow')

 

DELETE FROM tbl_SO_StepData

WHERE (FlowStepName = N'PR_Flow')

 

DELETE FROM tbl_SO_StepData

WHERE (FlowStepName = N'FR_Flow')

 

DELETE FROM tbl_SO_StepData

WHERE (FlowStepName = N'PSR_Flow')


DELETE FROM tbl_SO_StepData

WHERE (FlowStepName = N'EVR_Flow')

 

 

DELETE FROM tbl_SO_StepData

WHERE (FlowStepName = N'NVR_Flow')

 

DELETE FROM tbl_SO_StepData

WHERE (FlowStepName = N'RP_Flow')

 

 

DELETE FROM tbl_SO_StepData

WHERE (FlowStepName = N'FSR_Flow')

DELETE FROM tbl_SO_StepData

WHERE (FlowStepName = N'SoftDel')

 

DELETE FROM tbl_SO_Data

WHERE (Type = N'sPRUniqueID')

 

UPDATE tbl_SO_Data

SET Value = N'0'

WHERE (Type = N'sVPQty')

 

UPDATE tbl_SO_Data

SET Value = N'0'

WHERE (Type = N'sVPHoldQty')

 

UPDATE tbl_SO_Data

SET Value = N'0'

WHERE (Type = N'sVPProductionQty')

 

UPDATE tbl_SO_Data

SET Value = N'0'

WHERE (Type = N'sPDQty')

 

UPDATE tbl_SO_Data

SET Value = N'0'

WHERE (Type = N'sVPFGIQty')

 

UPDATE tbl_SO_Data

SET Value = N'0'

WHERE (Type = N'sVPShippedQty')

 

UPDATE tbl_SO_Data

SET Value = N'0'

WHERE (Type = N'sVPScrappedQty')

 

UPDATE tbl_SO_Data

SET Value = N'0'

WHERE (Type = N'sVPRMIQty')