Last post Dec 27, 2010 02:32 AM by mallireddy
Jan 27, 2007 02:54 AM|bbdo_inn|LINK
Jan 27, 2007 06:06 AM|ask_Scotty|LINK
Hello my friend,
What you are suggesting is a many-to-may relationship, which is bad. If you really need to do it this way, you need to remove the constraint so that the fields are there to query but the relationships are not enforced.
The other way, which is the best practice way, is to break the one-to-many relationship by creating a middle table. Suppose a customer could buy many products and a product could be purchased by many customers. The middle table would be something like
an OrderLine table. Now, a customer can have 1 or many order lines but an order line belongs to only 1 customer. And a product can be part of 1 or many order lines but an order line will only contain 1 product. If the customer buys 3 products as part of
an order, there would be 3 order lines.
Hope this helps
Jan 27, 2007 06:18 AM|MIB426|LINK
i think the tables are not design correctly
To me it looks like composite table...
i think have correct database design will make code easier
Dec 27, 2010 02:32 AM|mallireddy|LINK
Hi the same happend to me.In intervirew they asked to write TSQL code for inserting the data without disabling the constraint.
he told that with 3 dml statements its possible. can any one help.