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 2008 Forums
 Transact-SQL (2008)
 Column with ID related to different Tables?

Author  Topic 

sundawn
Starting Member

5 Posts

Posted - 2012-07-13 : 04:30:51
Hi,


i have to work with an given and old database.

There is a Table Documentation with fields AssetID and AssetKind.
There are lots of Tables for different Assets (Order,Invoice,Deliverynote,Offer,...)

So a Entry in Documentation would be
ID:1,AssetID:123,AssetKind:ConstantForOffer

I think this is not a good Design as you have to know what the AssetKind Constant means and what table to join depending on its value and so on.

Do you have any suggestions how to solve this problem in a more elegant way? I can not touch the general Design with different Assets in different Tables.

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-07-13 : 06:51:20
If I understood you correctly, you have one reference table which lists AssetIDs and the AssetKind of each AssetId along with an ID column. Then, other tables, when they want to refer to a given AssetId or AssetKind, they use the Id from this reference table.

If that is true, that does not seem like a bad design. Can you post some examples where you are running into problems because of this design?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-07-13 : 10:38:05
is that value within same column or data from multiple rows in documentation?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -