Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Parameterized views and integer primary keys
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00236927
Message ID:
00237004
Vues:
14
>I use to use characters strings as my primary keys, but now I would like to use integer keys. With characters strings as my PKs, I was able to set up a parameterized view that would let me select either one record or all records from a table. If I wanted one record, I would set my view paramter like this:
>
>lcJob_ID = "00001"
>
>before I required the view. If I wanted all records, I would set the paramter like this:
>
>lcJob_ID = SPACE(0)
>
>Can I do the same thing if I use integer PKs?
>

Not directly, but you can kludge it by defining your view something like this:

SELECT * FROM MyTable WHERE MyTable.PK = ?lnPK OR ?llAllRecords

You then have to make sure you set llallrecords to .F. before queryiing the view, or if you want all the records, set it to .T.

I know, not as slick as just setting your character varibale to "", but it works.
Erik Moore
Clientelligence
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform