Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Unique but not unique
Message
De
22/08/2008 12:29:29
 
 
À
20/08/2008 19:47:38
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01340637
Message ID:
01341166
Vues:
16
>How would you insure that the entries in a given field are unique OR blank? That is, multiple blank records are OK but if data is entered, it must be a unique value. Setting up a candidate index doesn't work due to the blank fields.

Filter the candidate index:
CREATE CURSOR a (b i)
INDEX on b FOR NOT EMPTY(b) TAG OnceNoZero CANDIDATE
ON ERROR wait window MESSAGE(LINE(1))

INSERT INTO a VALUES (0)
INSERT INTO a VALUES (0) && no error
INSERT INTO a VALUES (1)
INSERT INTO a VALUES (2)
INSERT INTO a VALUES (1) && error
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform