You are here: Re: Database design « MsSQL Server « IT news, forums, messages
Re: Database design

Posted by M A Srinivas on 05/26/07 06:41

On May 25, 9:18 pm, KR <kra...@bastyr.edu> wrote:
> Hi All,
>
> I wanted the expert opinion out there in the use of foreign keys as
> primary keys in a table. I am not very good at explaining this
> concept, but I am going to try -
>
> Let us say you have a parent/master table( Ex: purchase order) that
> is generating number (primary key for the main table)using the seed
> and increment specified. We need all the records of this table to be
> in sequential order - i.e. we need all purchase orders to be in
> sequence. Now there are two different types purchase orders different
> enough to have entity/tables of their own. So what are the downsides
> of using the primary key generated in the main table which would
> normally be a foreign key to the child table, as the actual primary
> key in the child tables.
>
> Thanks
>
> KR


1. Your PK is increment and seeded . So you are using Identity. Note
that Identity can have gaps .
2. If you have two different Purchase Order tables , what you can do
create another table having a union of PK from two tables and in
detail table FK will be pointing to this union table
3. If you don't want to go through 2, you need to create a trigger on
your detail table to check existence of key

 

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

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