Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Parameterized Views
Message
De
27/11/1999 17:08:04
 
 
À
27/11/1999 16:55:48
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00296038
Message ID:
00296042
Vues:
27
>Hello everyone,
>I would like to know how to pass a parameter to a view's "where" clause for conditions. For example, in different areas I may have different "where" clause conditions. In one instance, I may have "cField1 = 'x'" and in another instance "cField2 = 'y' .AND. !empty(cField1)". Is this possible? I had attempted the following but it did not work: "create sql view test as select * from myTable where ?x"
>then before issuing the "use test" I assigned x="cField1 = 'x'". I would appreciate any suggestions.

The problem is with the statement. If you really, absolutely need the generality of a single parameterizedview containing the expression to evaluate for the where, rather than the argument, you'd have to code something like:

CREATE SQL VIEW Test AS SELECT * FROM MyTable WHERE EVAL(?x)

This is never optimizable.

If you're always going to test cFiedl1, the following would be infinitely better, and optimizable:

CREATE SQL VIEW Test AS SELECT * FROM MyTable WHERE cField1 = ?x

and now assign "X" to x before USE Test or requerying, eg:

x= "x"
USE Test

You could now have a second view to check some other condition...as needed.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform