Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
dmoreira
Starting Member
1 Post |
Posted - 2007-10-11 : 15:03:00
|
Hi all, i'm a developer and have basic skills on data modeling and would like some help ... what i'm trying to achieve sounds like a dynamic relationship with 1 or more tables. What i'm trying to solve is that if, for example, i have a table called Sales that has a column ProductId and another column called ProductType (that could be a enumeration table) and depending of ProductType i will make a join on one or another table (if ProductType is Food them make a join to table Products_Food, if ProductType is Clothes them i make a join on Products_Clothes and so on).I really dont know if this is the best approach... probably i will have to use dynamic sql queries and i really dont like the idea. I know that i can make a deeper normalization and specialize more the Products table but the problem is that the businnes that this model is for (and its not Products and Sales) has a lot of attributes and i think that put all then in only one table i dont think that will work (i heard about the limit that is recomended for number of columns in a table).So, any help on that issue will be very wellcome. Thanks in advanceDan |
|
LoztInSpace
Aged Yak Warrior
940 Posts |
Posted - 2007-10-11 : 23:10:30
|
You have to determine what is common and what is not. Common stuff goes into a table called Products and food specific stuff goes into products_food etc. That's fine.There is rarely need to use dynamic SQL. When you are doing work specific to food then you need queries involving products_food. You already know this so no need for dynamic SQL. It sounds like you have not made enough (or indeed any) fields common. |
 |
|
|
|
|