Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Who should create the PK, view or table?
Message
From
13/09/2004 07:40:32
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
12/09/2004 22:44:59
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00941514
Message ID:
00941563
Views:
12
>Hi all,
>
>When adding records with views I don't where is the best place to create the primary key, the view or the table.
>I generate the PK with a newId() function, and I don't know whether to put it on the default value of the view field or the default value of the table itself. I "have" to put the code in the table just in case I don't use the view; so I thought that if I inserted the newId() in the view I would end up creating twice the PK (and wasting PK), but I tested and it was not the case. So I don't really know what should I do from a "good practices" point of view.

Creating the PK from the default value of the field, in the table, is quite simple. And, as far as I have seen, it works both in the table, and in the view based on the table.

I wouldn't define the PK in the view, precisely because you might want to open the table directly at some moment, and add records (interactively, or through a program).
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)
Previous
Reply
Map
View

Click here to load this message in the networking platform