Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Returning all records with an SQL statement
Message
De
15/11/2001 14:53:22
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00582293
Message ID:
00582316
Vues:
25
>Hi - I was wondering - I am am passing variable strings to an SQL select statement like this...
>
>Select * from customers where &lcString into cursor temp
>
>I can pass specific values like lcString = "Smith" etc but what do I need to do to return all the records? lcString = * ???
>

You can leave that portion of the where clause empty. For example:
lcWhereClause = ""
if not empty(lcLastName)  && hypothetical variable
   lcWhereClause = lcWhereClause + " lastName = lcLastName"
endif

if not empty(lcZip)
   lcWhereClause = lcWhereClause + " zipcode = lcZip"
endif

if not empty(lcWhereClause)
    lcWhereClause = "where " + lcWhereClause
endif

select * from customers &lcWhereClause into cursor temp
HTH,
Steve Gibson
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform