Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Returning all records with an SQL statement
Message
From
15/11/2001 14:53:22
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00582293
Message ID:
00582316
Views:
23
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform