Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

lookup table & main table relationship Expand / Collapse
Author
Message
Posted Tuesday, September 9, 2008 9:17 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Tuesday, May 8, 2012 12:49 PM
Points: 339, Visits: 560
Hi there,

I am working on creating data model from existing database.
Present DB is w/o PK-FKs & I am working to create relational DB which enforces RI etc
I have a lookup table which contains language codes,used by main table. The problem ,I am running into, is that these language codes(from lookup table) are used by 3 columns.
So, I am wondering how can I enforce PK-FK relationship here.
As in...
language_code from lookup table is PK and it has to associated w/ column(s) existing in main table

Thanks
Post #566252
Posted Tuesday, September 9, 2008 12:13 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: 2 days ago @ 6:53 AM
Points: 13,890, Visits: 28,285
If I understand the question, you simply add the relationship three different times, relating the lookup value to the three different columns individually. It's a fine method.

----------------------------------------------------
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood..." Theodore Roosevelt
The Scary DBA
Author of: SQL Server Query Performance Tuning
SQL Server 2012 Query Performance Tuning
SQL Server 2008 Query Performance Tuning Distilled
and
SQL Server Execution Plans

Product Evangelist for Red Gate Software
Post #566383
Posted Tuesday, September 9, 2008 12:52 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Tuesday, May 8, 2012 12:49 PM
Points: 339, Visits: 560
I am using Visio 2007 Professional and it seems VISIO doesn't allow relating a single column (from parent table) to 3 different columns. It associates with Either ColA or ColB or ColC.. not with all of them
Post #566414
Posted Tuesday, September 9, 2008 12:55 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: 2 days ago @ 6:53 AM
Points: 13,890, Visits: 28,285
Ah, that's a shortcoming with the tool, not SQL Server. Ummm, you might try associating to the first column and then renaming the association (not sure how to do that) and then try adding to the next column.

----------------------------------------------------
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood..." Theodore Roosevelt
The Scary DBA
Author of: SQL Server Query Performance Tuning
SQL Server 2012 Query Performance Tuning
SQL Server 2008 Query Performance Tuning Distilled
and
SQL Server Execution Plans

Product Evangelist for Red Gate Software
Post #566417
Posted Tuesday, September 9, 2008 12:58 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Tuesday, May 8, 2012 12:49 PM
Points: 339, Visits: 560
Thanks for quick response.
yes, its Visio related issue. :-|
thanks
Post #566421
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse