Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Creating a conditional 'where' clause
Message
 
À
03/06/1999 15:33:38
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00226172
Message ID:
00226203
Vues:
24
>I am trying to create a remote view (from SQL Server back end) that would emulate the following Passthrough code:
>
>
IF gcFunction = '001'
>  sqlexec(handle, 'select * from p1', 'p1')
>ELSE
>  sqlexec(handle, 'select * from p1 where p1_funckey = {gcfunction}', 'p1')
>ENDIF
>
>In other words, I want all records if the value of gcFunction is '001', otherwise I want to filter for p1_funckey equaling the value of gcFunction. I have already tried a variety of IIF() constructs in the where clause, but that doesn't work. How do I do this?
>
>Thanks

Valerie,

Create a prarmeterized view in the dbc with the WHERE clause of

p1_funckey = ?gcfucntion

Then use this code;

gcfunction = IIF( gcfunction = "001","",gcfunction)
USE TheView
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform