Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How To Create This CASE Statement
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
01444588
Message ID:
01444715
Views:
27
>>>How do you convert this to a CASE in SQL?
>>>
>>>
>>>IIf(Trim(RQ.RQ_MOSJOB)<>"","Work Order",IIf(Trim(RQ.RQ_MOCNUMBER)<>"","Customer Order","Other")) AS [Reqt Type], 
>>>
>>>
>>>Thanks
>>
>>
>>CASE WHEN LEN(RQ.RQ_MOSJOB) > 0
>>          THEN 'Work Order'
>>     WHEN LEN(RQ.RQ_MOCNUMBER) > 0
>>          THEN 'Customer Order'
>>     ELSE 'Other'
>>END
>>
>
>I would use LTRIM in case of leading spaces.

:-)
I'm so focused on my style that I do not expect to have leading spaces :-))))
(That is wrong of course)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform