Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Duplicate macro in the where clause
Message
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00883567
Message ID:
00883758
Vues:
7
Hi Kelly,

You've a couple of choices. You can build a select command as a string and than execute it using T-SQL command EXECUTE or system stored procedure sp_executesql. See Re: Dynamic Where Clause In Stored Procedure Thread #634614 Message #634628 for alternative solution which may or may not work for you.

>How would I duplicate making a portion of the where clause of a procedure change depending upon what value was passed to th procedure? In vfp I could use the macro substitution and do the following:
>
>If empty(x)
> whereclause = ' .t.'
>else
> whereclause = ' x = y'
>endif
>
>select * from tablea where b=c and &whereclause
>
>How would I duplicate this in my stored procedure with out making the select statement twice?
>
>Thanks in advance
>Kelly
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform