Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create a primary key
Message
From
12/01/1999 20:55:02
 
 
To
12/01/1999 06:18:49
Carla Silva
Http - Produtos Informaticos, Lda.
Odivelas, Portugal
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00174961
Message ID:
00175319
Views:
29
>How can I create a primary key with a FOR clause (FOR !DELETED())
>the code I`m using is:
>
>ALTER TABLE ceemcct ;
>ADD PRIMARY KEY str(numero,4)+dtos(Data_ldemp)+str(n_via,4) tag NumeroData
>
>Thanks

This can be done (as the others pointed out) but IMHO, it is a bad idea. First of all, indexes that use a FOR clause are not rushmore optimizable, and for the primary key this is bad news. You can get around this by creating a second, non-primary index and remove the FOR clause, but IMHO, the need to do what you are trying to do shows a less than optimal design.

In the long run, I think you will be happy using a surrogate primary key- one that has no meaning in the real world. That way, you don't have to recycle values. There are a slew of other reasons for doing this, just post if you need more-
Erik Moore
Clientelligence
Previous
Reply
Map
View

Click here to load this message in the networking platform