best way to proceduralize this?
Posted on 2009-12-28
i was going to use a TVP, but I am not writing the @deliverables to a table, i am merely using them to perform a join, and retrieve the dataset.
the given @delivarables are unknown. maybe one, maybe twenty.... but it will always be no,name,qty
declare @deliverables table (num int,name char(10),qty decimal(18,8))
insert @deliverables values
from tableA ug join tableB s on s.idfield = ug.idfield
join @deliverables d
on ug.num = d.num
and ug.idfield = s.idfield
and ug.qty = d.qty