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 2000 Forums
 SQL Server Development (2000)
 Foreign key naming convention

Author  Topic 

chris_t
Starting Member

6 Posts

Posted - 2004-06-25 : 05:53:03
This is a problem I often come across:

I have 2 foreign keys within one table both referencing the same table - what do you name each of the two foreign keys?

For example you have two types of user you want to associate to each record in a table, and all the users are stored within the one table.

Thanks

nr
SQLTeam MVY

12543 Posts

Posted - 2004-06-25 : 06:33:19
Something descriptive?

ContactUser_id
OwnerUser_id

A better option is to have another table for the link

tbl1_users
user_id, type

this allows you to link more user types without changing the structure.


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -