Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. sponsors. rss.
 From: Mike Yearwood
  Where is Mike Yearwood?
 Toronto
 Canada
 Mike Yearwood
 To: Ken Murphy
  Where is Ken Murphy?
 Springhill
 Canada
 Ken Murphy
 Tags
Subject: RE: The "Rule" for Primary Key Fields
Thread ID: 115198 Message ID: 119004 # Views: 35 # Ratings: 0
Version: Not Applicable Category: General VFP Topics
Date: Friday, January 19, 2007 1:58:58 AM         
   


> > > Terry,
> > >
> > > If you like the best of both worlds, you can use a RecordID field as your primary key, and an InvoiceNumber, PartNumber, or what ever you want as well. Use the RecordID field as the foreign key field in all of the other tables and now your InvoiceNumber or PartNumber can change and you don't have a problem (other than making sure it is unique.) Give it some thought - disk space is cheap and a "RecordID" integer field only costs four bytes. One more field won't add appreciably to your database size, and it can save you hours of work.
> > >
> > > Ken
> > > You shall know the truth - and the truth shall set you free. (John 8:33)
> >
> > Hi Ken
> >
> > Disk space is so cheap I suggest you consider the GUID. That way if you have to combine branch offices into a single table, there will be no worries about conflicting integer values. :)
> >
> >
> > Mike Yearwood
>
> Mike,
>
> Not sure what you are saying. If I had to combine branch offices (and I did have to a short while ago) it would be done with two commands:
>
>
> REPLACE ALL Supporter.OfficeID WITH lnSpringhillOfficeID ;
>         FOR Supporter.OfficeID = lnDartmouthOfficeID ;
>         IN [Supporters]
> REPLACE ALL Offices.Status WITH lnRetiredStatus ;
>         FOR Offices.RecordID = lnDartmouthOfficeID ;
>         IN [Offices]
> 

> No conflicts at all.
>
> If you are talking about combining the data from 2 databases, that is another matter, but I would probaby write a little conversion program if I had to do that.

Combining two tables - yes. :) With guid, no conversion program is necessary. :)
>
> Ken
> You shall know the truth - and the truth shall set you free. (John 8:33)



Mike Yearwood



COMPLETE THREAD
The "Rule" for Primary Key Fields Posted by Ken Murphy @ 12/6/2006 12:53:31 AM
RE: The "Rule" for Primary Key Fields Posted by Boudewijn Lutgerink @ 12/6/2006 8:32:13 AM
RE: The "Rule" for Primary Key Fields Posted by Ken Murphy @ 12/6/2006 2:11:55 PM
RE: The "Rule" for Primary Key Fields Posted by Borislav Borissov @ 12/6/2006 8:40:47 AM
RE: The "Rule" for Primary Key Fields Posted by Eric den Doop @ 12/6/2006 9:21:26 AM
RE: The "Rule" for Primary Key Fields Posted by Ken Murphy @ 12/6/2006 2:16:15 PM
RE: The "Rule" for Primary Key Fields Posted by sudhir uppal @ 1/12/2007 5:57:59 AM
RE: The "Rule" for Primary Key Fields Posted by William Sanders @ 1/12/2007 6:11:22 PM
RE: The "Rule" for Primary Key Fields Posted by Ken Murphy @ 1/12/2007 11:33:51 PM
RE: The "Rule" for Primary Key Fields Posted by Jamie Osborn @ 1/13/2007 2:05:07 AM
RE: The "Rule" for Primary Key Fields Posted by Ken Murphy @ 1/13/2007 2:20:51 AM
RE: The "Rule" for Primary Key Fields Posted by William Sanders @ 1/16/2007 9:49:00 PM
RE: The "Rule" for Primary Key Fields Posted by Ken Murphy @ 1/16/2007 10:25:38 PM
RE: The "Rule" for Primary Key Fields Posted by William Sanders @ 1/16/2007 10:25:30 PM
RE: The "Rule" for Primary Key Fields Posted by Terry Thurber @ 1/15/2007 12:41:55 AM
RE: The "Rule" for Primary Key Fields Posted by William Sanders @ 1/16/2007 9:50:14 PM
RE: The "Rule" for Primary Key Fields Posted by Terry Thurber @ 1/17/2007 7:17:35 AM
RE: The "Rule" for Primary Key Fields Posted by William Sanders @ 1/16/2007 9:58:37 PM
RE: The "Rule" for Primary Key Fields Posted by Terry Thurber @ 1/17/2007 7:44:55 AM
RE: The "Rule" for Primary Key Fields Posted by Eric den Doop @ 1/16/2007 10:56:36 PM
RE: The "Rule" for Primary Key Fields Posted by William Sanders @ 1/16/2007 11:20:56 PM
RE: The "Rule" for Primary Key Fields Posted by Terry Thurber @ 1/15/2007 1:29:36 AM
RE: The "Rule" for Primary Key Fields Posted by Ken Murphy @ 1/15/2007 9:56:37 PM
RE: The "Rule" for Primary Key Fields Posted by Mike Yearwood @ 1/18/2007 12:29:44 PM
RE: The "Rule" for Primary Key Fields Posted by Ken Murphy @ 1/18/2007 1:37:31 PM
RE: The "Rule" for Primary Key Fields Posted by Mike Yearwood @ 1/19/2007 1:58:58 AM
RE: The "Rule" for Primary Key Fields Posted by Ken Murphy @ 1/19/2007 3:41:03 PM
RE: The "Rule" for Primary Key Fields Posted by Andy Kramek @ 1/20/2007 7:12:23 PM
RE: The "Rule" for Primary Key Fields Posted by Mike Yearwood @ 1/20/2007 8:05:23 PM
RE: The "Rule" for Primary Key Fields Posted by Andy Kramek @ 1/20/2007 10:32:40 PM
RE: The "Rule" for Primary Key Fields Posted by Mike Yearwood @ 1/21/2007 4:40:22 PM
RE: The "Rule" for Primary Key Fields Posted by Andy Kramek @ 1/21/2007 7:13:22 PM
RE: The "Rule" for Primary Key Fields Posted by tushar @ 1/22/2007 6:02:17 AM
RE: The "Rule" for Primary Key Fields Posted by Andy Kramek @ 1/22/2007 12:15:08 PM
RE: The "Rule" for Primary Key Fields Posted by tushar @ 1/23/2007 8:26:36 AM