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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Table mapping

Author  Topic 

mrajani
Starting Member

13 Posts

Posted - 2008-04-30 : 03:09:47
Hi,

I am developing an application to a garment factory. I have a doubt in designing a table.

Basic tables:
Jobs, JobColors, Material, Units, Currencies ...
These tables are designed with normalization rules.
I got a problem at PurchaseOrderDetails

Main table is JobMaterial. It has materialid, jobid, supplierid, description and TypeFactor(which represents the type of order) means that the material is ordered based on size or colors or total qty.

1 for ByColor, 2 for BySize, 3 for ByQty, 4 for By Contrast colors

The main problem at the details of the sub table.

JobMaterialDetails

If typefactor is by size, i need to store the details based on size
ex: S - 2000pcs, M - 4000pcs, L - 4000pcs, XL - 2000pcs
So I will have 4 records per each size
If it is by color, White - 3000pcs, Portabella - 5000pcs, Black - 2000pcs.
If it is by general, Total qty 10000pcs

How can I design this table. If I take, ColorOrSize column, it will refer different values for diffrent typefactor. When by size, it will have Size and when by color, it will refer colorcode.
But colors are having referential integrity. So it is violated other than by color as typefactor.

What is the best way to design this table?
Can anybody suggest?

Thanks in advance
   

- Advertisement -