Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Table without PK - do I need one for View?
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00573010
Message ID:
00573174
Vues:
26
This message has been marked as a message which has helped to the initial question of the thread.
>Hi everybody,
>
>I have a table, which doesn't have a PK. I'd like to make an updatable local view based on this table. Do I need to make a PK? Can I use composite key, like bintoc(DsID)+extryear+extrweek (which should be unique...)?
>
>Thanks in advance.

Nadya,
You don't need a PK but you do need to make some designation of what constitutes a unique record. VFP uses this combination when it constructs the WHERE clause in the SQL Update statement.

In the View Designer, check off all fields that would make the record unique. Also, AFAIK, if using the designer, you have to have fields that are already in the view. You can add the BINTOC() function in the field list and use it as one of the key fields in the Update Criteria tab. Of course, if creating the view using code, you can simply use the BINTOC() in the WHERE clause directly without including it in the view.

HTH.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform