Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help with primary key
Message
De
23/07/2005 23:23:58
 
 
À
23/07/2005 23:06:34
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01035448
Message ID:
01035453
Vues:
11
Jimmy,

>I am trying to set a primary key for a character field and a date field through an expression. I have thhe following:
>
>ssnumber+orderdate
>
>ssnumber is a character field and the orderdate is a date field. When I try and save it I get the following:
>
>Operator/operand type mismatch
>
>Newbie and need help.

There are several ways to convert a date to a character representation of the date. In this case, I would use the expression ssnumber + DTOS(orderdate). Given an ssNumber '999999999' and today's date the expression would generate the string '99999999920050723'.

That said, using the ss number + the order date as a primary key will limit the orders to one order per person per day. If the limitation enforces a business rule, that's fine. If, however, there is no business rule that states the a person is limited to one order per day, then you have a design issue that may come back to bite you. In that case you might want to consider a surrogate primary key such as an autogenerated integer key.

Hope this helps.

Jim Fisher
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform