Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Table without PK - do I need one for View?
Message
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00573010
Message ID:
00573174
Views:
27
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
Previous
Reply
Map
View

Click here to load this message in the networking platform