• GO

    Drop view AssemblyDefects

    GO

    create View AssemblyDefects AS

    (select p.model, i.defect_title, p.item, d.sn, d.dateinspected, t.type, i.defect_id

    from productiondefect as d, assignworkorder as p, tlkp_defects as i, tlkp_item as t

    where substring(d.sn, 7, 5) = p.workorder

    and d.defect_id = i.defect_id

    and p.item = t.item)

    GO

    DROP Table ADR

    GO

    select *

    into ADR

    from AssemblyDefects