as i'm in a bit of a lul at the moment I thought I've have a crack at it, and its one of the most comprehensive set of DDL I've seen on SSC, even if it is a little overkill.
One think I did notice is that the Extended cost is set as a Decimal(18,2) and I believe money has 4 Decimal places, so you might get truncation occuring.
You also need to decide what to do if there is a rounding issue on the Unit cost calculation, eg 200.0000/3 is 66.6667, rounding up will give incorrect values when multiplied back out, rounding up 66.67*3 = 200.01 and if you round down its 199.98.
The Only column I cant seem to get data for is the ExtendedPrice, but this is a bare bones stab at what you might be looking for.
CREATE PROCEDURE InsertSalesOrderPart
Insert into SalesOrderPart
,0 ExtendedPrice -- WHERE DOES THIS COME FROM
From Part p
I would suggest runing this first and check the data you get for a specific set of paramaters.
DECLARE @OrderNumber Int = <replace with orderno>
,@PartNumber Int = <replace with partId>
,@Quantity Int = <replace with Quantity>
,@ExtendedCost Money =<replace with cost>
,0 ExtendedPrice --Where does this comefrom
From Part p
_________________________________________________________________________SSC Guide to Posting and Best Practices