I need to create a stored procedure with this code. I cannot figure out why the code will not execute inside the stored procedure.
Code:WITH temp_orgChart (dwgno, part, item, dim1, dim2, um, qty, iteration) AS ( SELECT dwgno, part, item, dim1, dim2, um, convert(int, qty), 0 FROM dbo.bomlog WHERE dwgno = 'tp134ae' UNION ALL SELECT b.dwgno, b.part, b.item, b.dim1, b.dim2, b.um, convert(int, b.qty) * convert(int, a.qty), a.iteration + 1 FROM temp_orgChart AS a, dbo.bomlog AS b WHERE a.part = b.dwgno ) SELECT dwgno, part, item, dim1, dim2, um, qty FROM temp_Orgchart WHERE um = 'si' OR um = 'in' or um = '"' or um = '"2' ORDER BY dwgno, part


Reply With Quote
