You are here: Re: SQL - Foreign key with references of multiple tables with same primary key field « MsSQL Server « IT news, forums, messages
Re: SQL - Foreign key with references of multiple tables with same primary key field

Posted by nehajain.cse on 04/19/07 11:06

On Apr 8, 11:34 pm, "M A Srinivas" <masri...@gmail.com> wrote:
> On Apr 9, 9:48 am, "Chirag" <chirag.dpa...@gmail.com> wrote:
>
> > I want to create a table with
>
> > member id(primary key for Students,faculty and staff [Tables])
>
> > and now i want to create issues[Tables] with foreign key as member id
> > but in references i could not able to pass on reference as or
> > condition for students, faculty and staff.
>
> > Thank You,
> > Chirag
>
> Two options
>
> 1. Create multiple member tables
> member_student,member_faculty,member_staff and
> issues_student,issues_faculty,issues_staff
>
> 2. Create a new column called flag in both the tables like
> Create table member ( memberid iNT, Flag Char(1) --S - Student,
> F- Faculty, T - Staff)
>
> Primary Key (flag,memberid)
> Create table Issues (memberid INT, Flag Char(1) -- S - Student, F-
> Faculty, T- Staff)
> Primary Key (flag,memberid)
>
> Now Reference two tables with flag and memberid.
>
> If you want to refernce member table with student,faculty,staff you
> need to handle in trigger

Hi,
cant be create one foreign key at column level and others at table
level

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация