Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Different options inside a procedure
Message
De
22/09/2003 16:33:38
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00830790
Message ID:
00831243
Vues:
19
You need to use the BEGIN/END construct like this:
If @param1 = x and @param2 = y
  select statement1
else
begin
  if @param1 = y and @param2 = x
    select statement2
  else
    select statement3
end
>I would like to create one procedure for a variety of possibilities. If one parameter is passed do a select statement with one set of criteria. If a different parameter is passed perform the select statment with a different set of criteria. I have tried this:
>
>If @param1 = x and @param2 = y
> select statement1
>else
> if @param1 = y and @param2 = x
> select statement2
> else
> select statement3
>
>When I execute the procedure the last select statment is always performed. What am I missing here? Or is there a better way of doing something like this?
>
>Thanks in advance
>Kelly
Thanks,
Dan Jurden
djurden@outlook.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform