First of all, don't put the name of the database in the stored procedure. Sooner or later you will want a test environment on the same instance you are on.
Next, the procedure seems somewhat strange. What if the customer already exists? Or do I get a new CustomerFK each time I place a new order?
You need to validate the OrderID, but I don't see any order ID as input?
For the table Link_OrderProduct you seem to have an IDENTITY column. I think the key on this table should be (OrderFK, ProductFK). Or can the same product appear twice on an order?
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
No comments:
Post a Comment