Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Primary Keys
Message
De
06/03/2003 05:53:29
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
06/03/2003 05:36:44
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00762036
Message ID:
00762046
Vues:
17
>Hi all,
>
>Was wondering, is there any way of using two primary keys in sync in the one table?? I am using a a table to store information on bookings, and in the table, it should store customer details, time, date, etc.
>
>I can't have the primary key as "date" alone, as I will have more than one customer on any one day, and I also can't have "time" as a primary key alone, as I will have customers on different dates at the THAT time. E.G.
>
>customer1 12.00 02-03-2003
>customer2 14.00 02-03-2003
>customer3 12.00 02-04-2003
>
>My problem is, I need to link these two fields("time" and "Date") so that they together make up a primary key, so that there is no time (which is usually hourly, as it's for a sports centre) AND date which is identical to another time AND date in that table.
>
>Can I have corresponding primary keys in the same table or do I need to go about it a different way????
>
>All suggestions welcomed.
>
>Thanks in advance,
>Mick

To combine more than one field type into an expression (like, for a primary key), convert everything to character, for instance: customer + dtos(MyDate).

On the other hand, I strongly recommend that your primary keys are some data the user doesn't see; for instance, an "auto-incrementing" integer. That way, you have smaller keys, and you never need to change the primary key.

HTH, Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform