Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Multiple where statements
Message
 
 
À
18/02/2005 11:44:10
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Divers
Thread ID:
00988288
Message ID:
01379115
Vues:
51
>Yes it does, I actually wrote the same exact code after
>I sent the reply. I do my best thinking after clicking
>the send button.
>Thank you for the positive stimulation!
>How do I get as knowledgeable as you besides
>practice. I have to do what ever they assign me
>to.
>
>Thanks again
>Jim
>
>
James,

I think this would be a better solution:

where (@Cost_Center = 'ALL' OR smp.item_cost_center LIKE @Cost_Center)


>
>>Would this work for you?
...
>>WHERE smp.item_cost_center LIKE
>>    CASE WHEN( @cost_center = 'ALL') THEN '%' ELSE @cost_center END
>>  AND smp.item_status LIKE
>>    CASE WHEN( @item_status = 'ALL') THEN '%' ELSE @item_status END
>>
>>
>>
>>
>>>Okay what if I had two variables?
>>>Here is my actual code.
>>>
>>>I am using this in the query analyzer to test
>>>before making it into a procedure.
>>>They chose between cost centers SMS, SMP, or ALL
>>>And if the item is active or inactive.
>>>
>>>I read the books online but it doesn't
>>>show case statements for multiple variables
>>>
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform