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:
01444591
Views:
34
>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(Ltrim(RQ.RQ_MOSJOB)) > 0 
                   then "Work Order" 
                   else 
                        case when len(lTrim(RQ.RQ_MOCNUMBER)) > 0 
                                    then "Customer Order" 
                                    else "Other" END
                END as [Reqt Type]
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform